XPathNavigator.MoveToFollowing XPathNavigator.MoveToFollowing XPathNavigator.MoveToFollowing XPathNavigator.MoveToFollowing Method

定義

XPathNavigator をドキュメント順で指定された要素に移動します。Moves the XPathNavigator to the specified element in document order.

オーバーロード

MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator)

指定された XPathNavigator の次の要素から指定された境界まで、XPathNodeType をドキュメント順に移動します。Moves the XPathNavigator to the following element of the XPathNodeType specified, to the boundary specified, in document order.

MoveToFollowing(String, String, XPathNavigator) MoveToFollowing(String, String, XPathNavigator) MoveToFollowing(String, String, XPathNavigator) MoveToFollowing(String, String, XPathNavigator)

指定されたローカル名と名前空間 URI を持つ要素から指定された境界に、XPathNavigator をドキュメント順に移動します。Moves the XPathNavigator to the element with the local name and namespace URI specified, to the boundary specified, in document order.

MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType)

指定された XPathNavigator の次の要素に、XPathNodeType をドキュメント順に移動します。Moves the XPathNavigator to the following element of the XPathNodeType specified in document order.

MoveToFollowing(String, String) MoveToFollowing(String, String) MoveToFollowing(String, String) MoveToFollowing(String, String)

指定されたローカル名と名前空間 URI を持つ要素に、XPathNavigator をドキュメント順に移動します。Moves the XPathNavigator to the element with the local name and namespace URI specified in document order.

MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator) MoveToFollowing(XPathNodeType, XPathNavigator)

指定された XPathNavigator の次の要素から指定された境界まで、XPathNodeType をドキュメント順に移動します。Moves the XPathNavigator to the following element of the XPathNodeType specified, to the boundary specified, in document order.

public:
 virtual bool MoveToFollowing(System::Xml::XPath::XPathNodeType type, System::Xml::XPath::XPathNavigator ^ end);
public virtual bool MoveToFollowing (System.Xml.XPath.XPathNodeType type, System.Xml.XPath.XPathNavigator end);
abstract member MoveToFollowing : System.Xml.XPath.XPathNodeType * System.Xml.XPath.XPathNavigator -> bool
override this.MoveToFollowing : System.Xml.XPath.XPathNodeType * System.Xml.XPath.XPathNavigator -> bool
Public Overridable Function MoveToFollowing (type As XPathNodeType, end As XPathNavigator) As Boolean

パラメーター

type
XPathNodeType XPathNodeType XPathNodeType XPathNodeType

要素の XPathNodeTypeThe XPathNodeType of the element. XPathNodeType は、Attribute および Namespace にはできません。The XPathNodeType cannot be Attribute or Namespace.

end
XPathNavigator XPathNavigator XPathNavigator XPathNavigator

現在の XPathNavigator が、次の要素の検索でこれより先に進まないようにする要素の境界に配置された XPathNavigator オブジェクト。The XPathNavigator object positioned on the element boundary which the current XPathNavigator will not move past while searching for the following element.

戻り値

XPathNavigator が正常に移動した場合は true。それ以外の場合は falsetrue if the XPathNavigator moved successfully; otherwise, false.

次の例XPathNavigatorでは、をcontosoBooks.xmlファイルのルートから次priceの要素に移動します。In the following example, the XPathNavigator is moved from the root of the contosoBooks.xml file to the following price element. XPathNavigatorオブジェクトの複製は、 Cloneメソッドを使用して作成されます。A clone of the XPathNavigator object is made using the Clone method. 要素に配置された複製XPathNavigatorが境界として使用されます。 priceThe cloned XPathNavigator, positioned on the price element, will be used as a boundary. 複製XPathNavigatorされたの位置の変更は、元XPathNavigatorのには影響しません。Changes in the position of the cloned XPathNavigator do not affect the original XPathNavigator. XPathNavigatorのは、 MoveToRootメソッドを使用して、 contosoBooks.xmlファイルのルートに戻されます。The original XPathNavigator is moved back to the root of the contosoBooks.xml file using the MoveToRoot method. 作成者のタイトルと姓と名は、 MoveToFollowingメソッドXPathNodeTypeおよびのTextを使用して取得します。The title and first and last name of the author are retrieved using the MoveToFollowing method and an XPathNodeType of Text. メソッドMoveToFollowingは、要素の境界にprice到達するまで true を返します。The MoveToFollowing method will return true until the price element boundary is reached.

    XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
    XPathNavigator^ navigator = document->CreateNavigator();

    navigator->MoveToFollowing("price", "http://www.contoso.com/books");
    XPathNavigator^ boundary = navigator->Clone();

    navigator->MoveToRoot();

while (navigator->MoveToFollowing(XPathNodeType::Text, boundary))
    {
        Console::WriteLine(navigator->OuterXml);
    }
XPathDocument document = new XPathDocument("contosoBooks.xml");
XPathNavigator navigator = document.CreateNavigator();

navigator.MoveToFollowing("price", "http://www.contoso.com/books");
XPathNavigator boundary = navigator.Clone();

navigator.MoveToRoot();

while (navigator.MoveToFollowing(XPathNodeType.Text, boundary))
{
    Console.WriteLine(navigator.OuterXml);
}
Dim document As XPathDocument = New XPathDocument("contosoBooks.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()

navigator.MoveToFollowing("price", "http://www.contoso.com/books")
Dim boundary As XPathNavigator = navigator.Clone()

navigator.MoveToRoot()

While navigator.MoveToFollowing(XPathNodeType.Text, boundary)
    Console.WriteLine(navigator.OuterXml)
End While

この例は、contosoBooks.xml ファイルを入力として使用します。The example takes the contosoBooks.xml file as an input.

  
<?xml version="1.0" encoding="utf-8" ?>  
<bookstore xmlns="http://www.contoso.com/books">  
    <book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0">  
        <title>The Autobiography of Benjamin Franklin</title>  
        <author>  
            <first-name>Benjamin</first-name>  
            <last-name>Franklin</last-name>  
        </author>  
        <price>8.99</price>  
    </book>  
    <book genre="novel" publicationdate="1967-11-17" ISBN="0-201-63361-2">  
        <title>The Confidence Man</title>  
        <author>  
            <first-name>Herman</first-name>  
            <last-name>Melville</last-name>  
        </author>  
        <price>11.99</price>  
    </book>  
    <book genre="philosophy" publicationdate="1991-02-15" ISBN="1-861001-57-6">  
        <title>The Gorgias</title>  
        <author>  
            <name>Plato</name>  
        </author>  
        <price>9.99</price>  
    </book>  
</bookstore>  
  

注釈

  • メソッドMoveToFollowingは、属性ノードまたは名前空間ノードに移動しません。The MoveToFollowing method does not move to attribute or namespace nodes. Attribute Namespace false XPathNavigatorパラメーター値がまたはの場合、 MoveToFollowingメソッドはを返し、の位置は変更されません。 XPathNodeTypeIf the XPathNodeType parameter value is Attribute or Namespace, the MoveToFollowing method returns false and the position of the XPathNavigator is unchanged.

  • パラメーターとして渡されたXPathNavigator 境界が、現在のの位置の後に配置されていない場合は、無視されます。XPathNavigatorIf the XPathNavigator boundary passed as a parameter is not positioned after the position of the current XPathNavigator it is ignored.

  • 境界XPathNavigatornullパラメーターとして渡された場合、指定さXPathNodeTypeれたを持つ次のノードがドキュメント順に配置されます。If XPathNavigator boundary passed as a parameter is null the next following node with the specified XPathNodeType is located in document order.

  • メソッドMoveToFollowingを使用して、属性または名前空間ノードに移動することはできません。The MoveToFollowing methods cannot be used to move to attribute or namespace nodes. パラメーターとして渡されたXPathNavigator 境界が属性ノードまたは名前空間ノードの上に配置されている場合、その親要素の最初の子ノードに配置された境界パラメーターと同じです。XPathNavigatorIf the XPathNavigator boundary passed as a parameter is positioned over an attribute or namespace node, it is equivalent to the XPathNavigator boundary parameter having been positioned on the first child node of its parent element. これにより、 XPathNavigator境界パラメーターが配置されている属性または名前空間ノードの親要素が、このメソッドに一致することが保証されます。This ensures that the parent element of the attribute or namespace node that the XPathNavigator boundary parameter is positioned on can be matched by this method.

  • メソッドがを返すfalse場合XPathNavigator 、の位置は変更されません。 MoveToFollowingIf the MoveToFollowing method returns false, the position of the XPathNavigator is unchanged.

MoveToFollowing(String, String, XPathNavigator) MoveToFollowing(String, String, XPathNavigator) MoveToFollowing(String, String, XPathNavigator) MoveToFollowing(String, String, XPathNavigator)

指定されたローカル名と名前空間 URI を持つ要素から指定された境界に、XPathNavigator をドキュメント順に移動します。Moves the XPathNavigator to the element with the local name and namespace URI specified, to the boundary specified, in document order.

public:
 virtual bool MoveToFollowing(System::String ^ localName, System::String ^ namespaceURI, System::Xml::XPath::XPathNavigator ^ end);
public virtual bool MoveToFollowing (string localName, string namespaceURI, System.Xml.XPath.XPathNavigator end);
abstract member MoveToFollowing : string * string * System.Xml.XPath.XPathNavigator -> bool
override this.MoveToFollowing : string * string * System.Xml.XPath.XPathNavigator -> bool
Public Overridable Function MoveToFollowing (localName As String, namespaceURI As String, end As XPathNavigator) 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.

end
XPathNavigator XPathNavigator XPathNavigator XPathNavigator

現在の XPathNavigator が、次の要素の検索でこれより先に進まないようにする要素の境界に配置された XPathNavigator オブジェクト。The XPathNavigator object positioned on the element boundary which the current XPathNavigator will not move past while searching for the following element.

戻り値

XPathNavigator が正常に移動した場合は true。それ以外の場合は falsetrue if the XPathNavigator moved successfully; otherwise, false.

次の例XPathNavigatorでは、をcontosoBooks.xmlファイルのルートから次bookの要素に移動します。In the following example, the XPathNavigator is moved from the root of the contosoBooks.xml file to the following book element. XPathNavigatorオブジェクトの複製は、 Cloneメソッドを使用して作成され、 book要素から次first-nameの要素に移動されます。A clone of the XPathNavigator object is made using the Clone method and is moved from the book element to the following first-name element. 要素に配置された複製XPathNavigatorが境界として使用されます。 first-nameThe cloned XPathNavigator, positioned on the first-name element, will be used as a boundary. 複製XPathNavigatorされたの位置の変更は、元XPathNavigatorのには影響しません。Changes in the position of the cloned XPathNavigator do not affect the original XPathNavigator. 次にXPathNavigator 、元のは、パラメーターとpriceして渡さMoveToFollowingれた境界を持つメソッドを使用して、次の要素への移動を試みます。The original XPathNavigator then attempts to move to the following price element using the MoveToFollowing method with the boundary passed as a parameter. priceの要素が境界を超えているため、この移動は失敗します。This move fails because the following price element is beyond the boundary. 次にXPathNavigator 、元のは、同じメソッドtitleを使用して、境界の前にある次の要素への移動を試み、成功します。The original XPathNavigator then attempts to move to the following title element which is before the boundary using the same method and succeeds.

XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
XPathNavigator^ navigator = document->CreateNavigator();

navigator->MoveToFollowing("book", "http://www.contoso.com/books");
XPathNavigator^ boundary = navigator->Clone();
boundary->MoveToFollowing("first-name", "http://www.contoso.com/books");

navigator->MoveToFollowing("price", "http://www.contoso.com/books", boundary);

Console::WriteLine("Position (after boundary): {0}", navigator->Name);
Console::WriteLine(navigator->OuterXml);

navigator->MoveToFollowing("title", "http://www.contoso.com/books", boundary);

Console::WriteLine("Position (before boundary): {0}", navigator->Name);
Console::WriteLine(navigator->OuterXml);
XPathDocument document = new XPathDocument("contosoBooks.xml");
XPathNavigator navigator = document.CreateNavigator();

navigator.MoveToFollowing("book", "http://www.contoso.com/books");
XPathNavigator boundary = navigator.Clone();
boundary.MoveToFollowing("first-name", "http://www.contoso.com/books");

navigator.MoveToFollowing("price", "http://www.contoso.com/books", boundary);

Console.WriteLine("Position (after boundary): {0}", navigator.Name);
Console.WriteLine(navigator.OuterXml);

navigator.MoveToFollowing("title", "http://www.contoso.com/books", boundary);

Console.WriteLine("Position (before boundary): {0}", navigator.Name);
Console.WriteLine(navigator.OuterXml);
Dim document As XPathDocument = New XPathDocument("contosoBooks.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()

navigator.MoveToFollowing("book", "http://www.contoso.com/books")
Dim boundary As XPathNavigator = navigator.Clone()
boundary.MoveToFollowing("first-name", "http://www.contoso.com/books")

navigator.MoveToFollowing("price", "http://www.contoso.com/books", boundary)

Console.WriteLine("Position (after boundary): {0}", navigator.Name)
Console.WriteLine(navigator.OuterXml)

navigator.MoveToFollowing("title", "http://www.contoso.com/books", boundary)

Console.WriteLine("Position (before boundary): {0}", navigator.Name)
Console.WriteLine(navigator.OuterXml)

この例は、contosoBooks.xml ファイルを入力として使用します。The example takes the contosoBooks.xml file as an input.

  
<?xml version="1.0" encoding="utf-8" ?>  
<bookstore xmlns="http://www.contoso.com/books">  
    <book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0">  
        <title>The Autobiography of Benjamin Franklin</title>  
        <author>  
            <first-name>Benjamin</first-name>  
            <last-name>Franklin</last-name>  
        </author>  
        <price>8.99</price>  
    </book>  
    <book genre="novel" publicationdate="1967-11-17" ISBN="0-201-63361-2">  
        <title>The Confidence Man</title>  
        <author>  
            <first-name>Herman</first-name>  
            <last-name>Melville</last-name>  
        </author>  
        <price>11.99</price>  
    </book>  
    <book genre="philosophy" publicationdate="1991-02-15" ISBN="1-861001-57-6">  
        <title>The Gorgias</title>  
        <author>  
            <name>Plato</name>  
        </author>  
        <price>9.99</price>  
    </book>  
</bookstore>  
  

注釈

  • パラメーターとして渡されたXPathNavigator 境界が、現在のの位置の後に配置されていない場合は、無視されます。XPathNavigatorIf the XPathNavigator boundary passed as a parameter is not positioned after the position of the current XPathNavigator it is ignored.

  • 境界パラメーターがnullの場合、指定されたローカル名と名前空間 URI を持つ次の要素はドキュメント順に配置されます。 XPathNavigatorIf the XPathNavigator boundary parameter is null, the following element with the local name and namespace URI specified is located in document order.

  • メソッドMoveToFollowingを使用して、属性または名前空間ノードに移動することはできません。The MoveToFollowing methods cannot be used to move to attribute or namespace nodes. パラメーターとして渡されたXPathNavigator 境界が属性ノードまたは名前空間ノードの上に配置されている場合、その親要素の最初の子ノードに配置された境界パラメーターと同じです。XPathNavigatorIf the XPathNavigator boundary passed as a parameter is positioned over an attribute or namespace node, it is equivalent to the XPathNavigator boundary parameter having been positioned on the first child node of its parent element. これにより、 XPathNavigator境界パラメーターが配置されている属性または名前空間ノードの親要素が、このメソッドに一致することが保証されます。This ensures that the parent element of the attribute or namespace node that the XPathNavigator boundary parameter is positioned on can be matched by this method.

  • メソッドがを返すfalse場合XPathNavigator 、の位置は変更されません。 MoveToFollowingIf the MoveToFollowing method returns false, the position of the XPathNavigator is unchanged.

MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType) MoveToFollowing(XPathNodeType)

指定された XPathNavigator の次の要素に、XPathNodeType をドキュメント順に移動します。Moves the XPathNavigator to the following element of the XPathNodeType specified in document order.

public:
 virtual bool MoveToFollowing(System::Xml::XPath::XPathNodeType type);
public virtual bool MoveToFollowing (System.Xml.XPath.XPathNodeType type);
abstract member MoveToFollowing : System.Xml.XPath.XPathNodeType -> bool
override this.MoveToFollowing : System.Xml.XPath.XPathNodeType -> bool
Public Overridable Function MoveToFollowing (type As XPathNodeType) As Boolean

パラメーター

type
XPathNodeType XPathNodeType XPathNodeType XPathNodeType

要素の XPathNodeTypeThe XPathNodeType of the element. XPathNodeType は、Attribute および Namespace にはできません。The XPathNodeType cannot be Attribute or Namespace.

戻り値

XPathNavigator が正常に移動した場合は true。それ以外の場合は falsetrue if the XPathNavigator moved successfully; otherwise, false.

次の例XPathNavigatorでは、をcontosoBooks.xmlファイルのルートから次bookstoreの要素に移動します。In the following example, the XPathNavigator is moved from the root of the contosoBooks.xml file to the following bookstore element.

    XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
    XPathNavigator^ navigator = document->CreateNavigator();

navigator->MoveToFollowing(XPathNodeType::Element);

    Console::WriteLine("Position: {0}", navigator->Name);
    Console::WriteLine(navigator->OuterXml);
XPathDocument document = new XPathDocument("contosoBooks.xml");
XPathNavigator navigator = document.CreateNavigator();

navigator.MoveToFollowing(XPathNodeType.Element);

Console.WriteLine("Position: {0}", navigator.Name);
Console.WriteLine(navigator.OuterXml);
Dim document As XPathDocument = New XPathDocument("contosoBooks.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()

navigator.MoveToFollowing(XPathNodeType.Element)

Console.WriteLine("Position: {0}", navigator.Name)
Console.WriteLine(navigator.OuterXml)

この例は、contosoBooks.xml ファイルを入力として使用します。The example takes the contosoBooks.xml file as an input.

  
<?xml version="1.0" encoding="utf-8" ?>  
<bookstore xmlns="http://www.contoso.com/books">  
    <book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0">  
        <title>The Autobiography of Benjamin Franklin</title>  
        <author>  
            <first-name>Benjamin</first-name>  
            <last-name>Franklin</last-name>  
        </author>  
        <price>8.99</price>  
    </book>  
    <book genre="novel" publicationdate="1967-11-17" ISBN="0-201-63361-2">  
        <title>The Confidence Man</title>  
        <author>  
            <first-name>Herman</first-name>  
            <last-name>Melville</last-name>  
        </author>  
        <price>11.99</price>  
    </book>  
    <book genre="philosophy" publicationdate="1991-02-15" ISBN="1-861001-57-6">  
        <title>The Gorgias</title>  
        <author>  
            <name>Plato</name>  
        </author>  
        <price>9.99</price>  
    </book>  
</bookstore>  
  

注釈

MoveToFollowing(String, String) MoveToFollowing(String, String) MoveToFollowing(String, String) MoveToFollowing(String, String)

指定されたローカル名と名前空間 URI を持つ要素に、XPathNavigator をドキュメント順に移動します。Moves the XPathNavigator to the element with the local name and namespace URI specified in document order.

public:
 virtual bool MoveToFollowing(System::String ^ localName, System::String ^ namespaceURI);
public virtual bool MoveToFollowing (string localName, string namespaceURI);
abstract member MoveToFollowing : string * string -> bool
override this.MoveToFollowing : string * string -> bool
Public Overridable Function MoveToFollowing (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.

戻り値

XPathNavigator が正常に移動した場合は true。それ以外の場合は falsetrue if the XPathNavigator moved successfully; otherwise, false.

次の例では、 XPathNavigator contosoBooks.xmlファイルのルートから最初priceの要素にが移動されます。In the following example, the XPathNavigator is moved from the root of the contosoBooks.xml file to the first price element.

XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
XPathNavigator^ navigator = document->CreateNavigator();

navigator->MoveToFollowing("price", "http://www.contoso.com/books");

Console::WriteLine("Position: {0}", navigator->Name);
Console::WriteLine(navigator->OuterXml);
XPathDocument document = new XPathDocument("contosoBooks.xml");
XPathNavigator navigator = document.CreateNavigator();

navigator.MoveToFollowing("price", "http://www.contoso.com/books");

Console.WriteLine("Position: {0}", navigator.Name);
Console.WriteLine(navigator.OuterXml);
Dim document As XPathDocument = New XPathDocument("contosoBooks.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()

navigator.MoveToFollowing("price", "http://www.contoso.com/books")

Console.WriteLine("Position: {0}", navigator.Name)
Console.WriteLine(navigator.OuterXml)

この例は、contosoBooks.xml ファイルを入力として使用します。The example takes the contosoBooks.xml file as an input.

  
<?xml version="1.0" encoding="utf-8" ?>  
<bookstore xmlns="http://www.contoso.com/books">  
    <book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0">  
        <title>The Autobiography of Benjamin Franklin</title>  
        <author>  
            <first-name>Benjamin</first-name>  
            <last-name>Franklin</last-name>  
        </author>  
        <price>8.99</price>  
    </book>  
    <book genre="novel" publicationdate="1967-11-17" ISBN="0-201-63361-2">  
        <title>The Confidence Man</title>  
        <author>  
            <first-name>Herman</first-name>  
            <last-name>Melville</last-name>  
        </author>  
        <price>11.99</price>  
    </book>  
    <book genre="philosophy" publicationdate="1991-02-15" ISBN="1-861001-57-6">  
        <title>The Gorgias</title>  
        <author>  
            <name>Plato</name>  
        </author>  
        <price>9.99</price>  
    </book>  
</bookstore>  
  

注釈

メソッドがを返すfalse場合XPathNavigator 、の位置は変更されません。 MoveToFollowingIf the MoveToFollowing method returns false, the position of the XPathNavigator is unchanged.

適用対象