How to remove all comment tags from XmlDocument

Posted by Filburt on Stack Overflow See other posts from Stack Overflow or by Filburt
Published on 2009-12-09T14:06:51Z Indexed on 2010/05/24 7:51 UTC
Read the original article Hit count: 242

Filed under:
|
|

How would i go about to remove all comment tags from a XmlDocument instance?

Is there a better way than retrieving a XmlNodeList and iterate over those?


    XmlNodeList list = xmlDoc.SelectNodes("//comment()");

    foreach(XmlNode node in list)
    {
        node.ParentNode.RemoveChild(node);
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET