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

定义

一直读取,直到找到命名元素。Reads until the named element is found.

重载

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)

一直读取,直到找到具有指定的本地名称和命名空间 URI 的元素。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

参数

name
String String String String

元素的限定名。The qualified name of the element.

返回

如果找到匹配的元素,则为 true;否则为 falseXmlReader 位于文件的末尾。true if a matching element is found; otherwise false and the XmlReader is in an end of file state.

异常

在上一次异步操作完成之前调用了 XmlReader 方法。An XmlReader method was called before a previous asynchronous operation finished. 在此情况下,会引发 InvalidOperationException 并显示消息“异步操作已在进行中。”In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

参数是空字符串。The parameter is an empty string.

注解

此方法是功能上等效执行following::name从当前节点的 XPath 表达式。This method is functionally equivalent executing the following::name XPath expression from the current node. 它提供了在 XML 文档中查找命名的元素的快速方法。It provides a quick way to find a named element in the XML document. 将读取器推进到与指定的名称相匹配,并返回下一个后续元素true如果找到匹配的元素。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)

一直读取,直到找到具有指定的本地名称和命名空间 URI 的元素。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

参数

localName
String String String String

元素的本地名称。The local name of the element.

namespaceURI
String String String String

元素的命名空间 URI。The namespace URI of the element.

返回

如果找到匹配的元素,则为 true;否则为 falseXmlReader 位于文件的末尾。true if a matching element is found; otherwise false and the XmlReader is in an end of file state.

异常

在上一次异步操作完成之前调用了 XmlReader 方法。An XmlReader method was called before a previous asynchronous operation finished. 在此情况下,会引发 InvalidOperationException 并显示消息“异步操作已在进行中。”In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

两个参数值均为 nullBoth parameter values are null.

注解

此方法是功能上等效执行following::name从当前节点的 XPath 表达式。This method is functionally equivalent executing the following::name XPath expression from the current node. 它提供了在 XML 文档中查找命名的元素的快速方法。It provides a quick way to find a named element in the XML document. 将读取器推进到与指定的名称相匹配,并返回下一个后续元素true如果找到匹配的元素。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.

适用于