System.Xml.XmlReader.Skip Method

Skips the children of the current node.

Syntax

public virtual void Skip ()

Exceptions

TypeReason
System.Xml.XmlExceptionThe XML was not well-formed, or an error occurred while parsing the XML.

Remarks

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 XmlReader.Read.

Example

 <a name="bob" age="123">
  <x/>abc<y/>
 </a>
 <b>
 ...
 </b>

This method checks for well-formed XML.

If the reader is an System.Xml.XmlValidatingReader, this method also validates the skipped content.

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.

System.Xml.XmlTextReader

No.

System.Xml.XmlReader instance created by the erload:System.Xml.XmlReader.Create method that is reading text data.

No.

System.Xml.XmlReader instance created by the erload:System.Xml.XmlReader.Create method that is reading binary data.

Not applicable.

A schema validating System.Xml.XmlReader instance created by the erload:System.Xml.XmlReader.Create method.

Yes.

System.Xml.XmlValidatingReader

Yes.

System.Xml.XmlReader instance returned by a System.Xml.XPath.XPathNavigator object.

Not applicable.

System.Xml.XmlNodeReader

No.

System.Xml.XmlReader instance wrapped around another System.Xml.XmlReader instance.

Depends on the implementation of the underlying System.Xml.XmlReader. (The Skip method on the underlying System.Xml.XmlReader is called).

For the asynchronous version of this method, see XmlReader.SkipAsync.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0