Loading HTML page that displays XML

Sep 29, 2009 at 7:19 AM

Does anyone know what is the best approach for loading a page that displays XML using the HtmlAgilityPack?  I've noticed that the InnerText of the Document element contains "\r\n-" characters throughout the text.  As a result, when I use SelectSingleNode to grab one element, more child nodes are created than what i would have expected.  The reason for this is because child nodes were created for the "\r\n-" characters...

Anyone have any ideas?



Oct 3, 2009 at 3:33 AM

You can filter out those nodes by their NodeType. You'll see they will be HtmlNodeType.Text

Another thing is to just loop through and eliminate them by doing a trim on their value and if they are empty, then you can remove them from the collection.