CSharp examples for System.Xml:XML Element
Skips current element and moves to next element. Similar to XmlReader.Skip, but this method also skips even if current node is text node.
using System.Xml; public class Main{ /// <summary> /// Skips current element and moves to next element. Similar to XmlReader.Skip, but this method also skips even if current node is text node. /// </summary> /// <param name="reader">XmlReader with current node of element or text of element.</param> public static bool MoveToFirstChild(this XmlReader reader) {/*from ww w . jav a2s. c om*/ if (!reader.IsEmptyElement) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) return true; if (reader.NodeType == XmlNodeType.EndElement) break; } } // Read past end element reader.Read(); return false; } }