Export (0) Print
Expand All

XmlReader.Skip Method

Skips the children of the current node.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

'Declaration
Public Overridable Sub Skip

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


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft