[Home] [By Thread] [By Date] [Recent Entries]

  • To: Bill de hÓra <bill@d...>
  • Subject: RE: On the promotion and demotion of information items (was Re: RE: Take 2 - How do you replace comments from XML?)
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Thu, 6 Mar 2003 05:48:24 -0800
  • Cc: "Alaric B. Snell" <alaric@a...>,"Rick Jelliffe" <ricko@a...>,<xml-dev@l...>
  • Thread-index: AcLj4Oo5vl47y/z3RBqSmtlWGb85swABdb+3
  • Thread-topic: On the promotion and demotion of information items (was Re: RE: Take 2 - How do you replace comments from XML?)

using System; 
using System.Xml; 
 
public class Test{
  public static void Main(string[] args){
 
    XmlDocument doc = new XmlDocument(); 
    doc.Load("config.xml"); 
    XmlNode curr = doc.SelectSingleNode("//comment()[contains(.,'Start xxxx.Net')]");
    XmlNode parent = curr.ParentNode, deleted;
    
    do{       
      deleted = curr;
      curr    = curr.NextSibling;
      parent.RemoveChild(deleted); 
      
    }while((deleted.NodeType != XmlNodeType.Comment) || 
    (!deleted.Value.Equals(" End xxxx.Net "))); 
 
      Console.WriteLine(doc.OuterXml);
  }
}

________________________________

From: Bill de hÓra [mailto:bill@d...]
Sent: Thu 3/6/2003 5:04 AM
To: Dare Obasanjo
Cc: Alaric B. Snell; Rick Jelliffe; xml-dev@l...
Subject: Re:  On the promotion and demotion of information items (was Re:  RE: Take 2 - How do you replace comments from XML?)



Like I said, if you have useful advice on processing this file, I'm
sure the OP would like to hear it (I certainly would). 

Bill de hÓra





Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member