.NET: How to ignore comments when reading a XML file into a XmlDocument?

Posted by tunnuz on Stack Overflow See other posts from Stack Overflow or by tunnuz
Published on 2010-05-20T16:10:41Z Indexed on 2010/05/20 16:20 UTC
Read the original article Hit count: 252

Filed under:
|
|
|
|

Hello, I am trying to read a XML document with C#, I am doing it this way:

XmlDocument myData = new XmlDocument();
myData.Load("datafile.xml");

anyway, I sometimes get comments when reading XmlNode.ChildNodes. Is there a way to avoid that? I know that you can avoid reading comments if you use XmlReader, but then, how to get the XmlDocument out of a XmlReader?

Thank you
Tommaso

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#