XmlReader.Skip Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Skips the children of the current node.
Assembly: System.Xml (in System.Xml.dll)
In the following XML input if the reader is positioned on the <a> node or any of its attributes, calling Skip positions the reader to the <b> node.
If the reader is positioned on a leaf node already (such as the <x> node or the text node abc), calling Skip is the same as calling Read.
<a name="bob" age="123"> <x/>abc<y/> </a> <b> ... </b>
This method checks for well-formed XML.
The XmlReader implementation determines whether or not the Skip method will expand external entities. The following table describes whether the external entities are expanded for the various types of XmlReader objects.
Type of XmlReader | Expands external entities |
|---|---|
XmlReader instance created by the Create method that is reading text data. | No. |
XmlReader instance created by the Create method that is reading binary data. | Not applicable. |
XmlReader instance wrapped around another XmlReader instance. | Depends on the implementation of the underlying XmlReader. (The Skip method on the underlying XmlReader is called). |
Dim xmlString As String = _ "<bookstore>" & _ "<book genre='novel' ISBN='10-861003-324'>" & _ "<title>The Handmaid's Tale</title>" & _ "<price>19.95</price>" & _ "</book>" & _ "<book genre='novel' ISBN='1-861001-57-5'>" & _ "<title>Pride And Prejudice</title>" & _ "<price>24.95</price>" & _ "</book>" & _ "</bookstore>" ' Load the file and ignore all white space. Dim settings As New XmlReaderSettings() settings.IgnoreWhitespace = True Using reader As XmlReader = XmlReader.Create(New StringReader(xmlString), settings) ' Position the reader on the second book node reader.ReadToFollowing("book") reader.Skip() ' Create another reader that contains just the second book node. Dim inner As XmlReader = reader.ReadSubtree() ' Do additional processing on the inner reader. After you ' are done, you can call Close on the inner reader and ' continue processing using the original reader. End Using