XmlReader.ReadToFollowing XmlReader.ReadToFollowing XmlReader.ReadToFollowing XmlReader.ReadToFollowing Method

Definition

Reads until the named element is found.

Overloads

ReadToFollowing(String) ReadToFollowing(String) ReadToFollowing(String) ReadToFollowing(String)

Reads until an element with the specified qualified name is found.

ReadToFollowing(String, String) ReadToFollowing(String, String) ReadToFollowing(String, String) ReadToFollowing(String, String)

Reads until an element with the specified local name and namespace URI is found.

ReadToFollowing(String) ReadToFollowing(String) ReadToFollowing(String) ReadToFollowing(String)

Reads until an element with the specified qualified name is found.

public:
 virtual bool ReadToFollowing(System::String ^ name);
public virtual bool ReadToFollowing (string name);
abstract member ReadToFollowing : string -> bool
override this.ReadToFollowing : string -> bool
Public Overridable Function ReadToFollowing (name As String) As Boolean

Parameters

name
String String String String

The qualified name of the element.

Returns

true if a matching element is found; otherwise false and the XmlReader is in an end of file state.

Exceptions

An XmlReader method was called before a previous asynchronous operation finished. In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

Remarks

This method is functionally equivalent executing the following::name XPath expression from the current node. It provides a quick way to find a named element in the XML document. It advances the reader to the next following element that matches the specified name and returns true if a matching element is found. Using the example below, the reader would read to the first instance of the specified element while reading forward.

<!--"sample.xml"-->  
<?xml version="1.0">  
   <items>  
      <item xmls="urn:1"/>  
   </items>  
</xml>  
  
XmlTextReader reader = newXmlTextReader("sample.xml");  
  
reader.ReadToFollowing("item");  
  

This method can be called on all node types.

ReadToFollowing(String, String) ReadToFollowing(String, String) ReadToFollowing(String, String) ReadToFollowing(String, String)

Reads until an element with the specified local name and namespace URI is found.

public:
 virtual bool ReadToFollowing(System::String ^ localName, System::String ^ namespaceURI);
public virtual bool ReadToFollowing (string localName, string namespaceURI);
abstract member ReadToFollowing : string * string -> bool
override this.ReadToFollowing : string * string -> bool
Public Overridable Function ReadToFollowing (localName As String, namespaceURI As String) As Boolean

Parameters

localName
String String String String

The local name of the element.

namespaceURI
String String String String

The namespace URI of the element.

Returns

true if a matching element is found; otherwise false and the XmlReader is in an end of file state.

Exceptions

An XmlReader method was called before a previous asynchronous operation finished. In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

Remarks

This method is functionally equivalent executing the following::name XPath expression from the current node. It provides a quick way to find a named element in the XML document. It advances the reader to the next following element that matches the specified name and returns true if a matching element is found.

<!--"sample.xml"-->  
<?xml version="1.0">  
   <items>  
      <item xmls="urn:1"/>  
   </items>  
</xml>  
  
XmlTextReader reader = newXmlTextReader("sample.xml");  
  
reader.ReadToFollowing("item", "urn:1");  
  

This method can be called on all node types.

Applies to