Apparently XmlNode.ChildNodes-list (in C# .Net) contains not only real child nodes, but also special whitespace nodes. So even in the simplest case when having one tag inside another you can get parentNode.ChildNodes.Count == 3. How to get around this?
Already tried:
xmlDocument.PreserveWhitespace = false;
Also:
foreach(XmlNode node in xmlDocument.SelectNodes("//*))
if (node is XmlWhitespace)
node.ParentNode.RemoveChild(node);
Text nodes are first class children. I guess you want Element nodes only. Can’t you do
Or are you saying that
<root><child></root>results in root having three child nodes?