XPathNavigator.MoveToFollowing メソッド

定義

XPathNavigator をドキュメント順で指定された要素に移動します。

オーバーロード

MoveToFollowing(XPathNodeType, XPathNavigator)

指定された XPathNavigator の次の要素から指定された境界まで、XPathNodeType をドキュメント順に移動します。

MoveToFollowing(String, String, XPathNavigator)

指定されたローカル名と名前空間 URI を持つ要素から指定された境界に、XPathNavigator をドキュメント順に移動します。

MoveToFollowing(XPathNodeType)

指定された XPathNavigator の次の要素に、XPathNodeType をドキュメント順に移動します。

MoveToFollowing(String, String)

指定されたローカル名と名前空間 URI を持つ要素に、XPathNavigator をドキュメント順に移動します。

MoveToFollowing(XPathNodeType, XPathNavigator)

指定された XPathNavigator の次の要素から指定された境界まで、XPathNodeType をドキュメント順に移動します。

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);
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

要素の XPathNodeTypeXPathNodeType は、Attribute および Namespace にはできません。

end
XPathNavigator

現在の XPathNavigator が、次の要素の検索でこれより先に進まないようにする、要素の境界に配置された XPathNavigator オブジェクト。

戻り値

Boolean

XPathNavigator が正常に移動した場合は true。それ以外の場合は false

次の例では、ファイルのXPathNavigatorルートから次pricecontosoBooks.xml要素に移動します。 オブジェクトの XPathNavigator 複製は、メソッドを Clone 使用して作成されます。 要素上にprice配置された複製XPathNavigatorは、境界として使用されます。 複製された位置の変更は XPathNavigator 、元 XPathNavigatorのオブジェクトには影響しません。 元XPathNavigatorのファイルは、メソッドを使用してファイルのルートにMoveToRootcontosoBooks.xml戻されます。 作成者のタイトルと姓は、メソッドとXPathNodeTypeText次のメソッドをMoveToFollowing使用して取得されます。 このメソッドは MoveToFollowing 、要素の境界に price 達するまで true を返します。

    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 ファイルを入力として使用します。

<?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 、属性ノードまたは名前空間ノードに移動しません。 パラメーター値が or のXPathNodeType場合、メソッドはAttributeMoveToFollowing戻り値を返falseし、そのXPathNavigator位置は変更Namespaceされません。

  • XPathNavigatorパラメーターとして渡された境界が現在XPathNavigatorの位置の後に配置されていない場合は無視されます。

  • パラメーターとして渡された境界が、指定されたXPathNodeType次のノードであるnull場合XPathNavigatorは、ドキュメントの順序で配置されます。

  • メソッド MoveToFollowing を使用して属性ノードまたは名前空間ノードに移動することはできません。 XPathNavigatorパラメーターとして渡された境界が属性または名前空間ノード上に配置されている場合、その境界パラメーターは、親要素のXPathNavigator最初の子ノードに配置された境界パラメーターと同じです。 これにより、境界パラメーターが配置されている属性または名前空間ノード XPathNavigator の親要素を、このメソッドで一致させることができます。

  • メソッドが返されたMoveToFollowingfalse場合、その位置XPathNavigatorは変更されません。

適用対象

MoveToFollowing(String, String, XPathNavigator)

指定されたローカル名と名前空間 URI を持つ要素から指定された境界に、XPathNavigator をドキュメント順に移動します。

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);
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

要素のローカル名。

namespaceURI
String

要素の名前空間 URI。

end
XPathNavigator

現在の XPathNavigator が、次の要素の検索でこれより先に進まないようにする要素の境界に配置された XPathNavigator オブジェクト。

戻り値

Boolean

XPathNavigator が正常に移動した場合は true。それ以外の場合は false

次の例では、ファイルのXPathNavigatorルートから次bookcontosoBooks.xml要素に移動します。 オブジェクトの複製はメソッドをXPathNavigatorClone使用して作成され、要素から次first-namebook要素に移動されます。 要素上にfirst-name配置された複製XPathNavigatorは、境界として使用されます。 複製された位置の変更は XPathNavigator 、元 XPathNavigatorのオブジェクトには影響しません。 元XPathNavigatorの要素は、パラメーターとして渡された境界を持つメソッドをMoveToFollowing使用して、次priceの要素への移動を試みます。 次 price の要素が境界を越えているため、この移動は失敗します。 元 XPathNavigator の要素は、同じメソッドを使用して境界の前にある次 title の要素に移動を試み、成功します。

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 ファイルを入力として使用します。

<?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パラメーターとして渡された境界が現在XPathNavigatorの位置の後に配置されていない場合は無視されます。

  • 境界パラメーターが指定されている XPathNavigator 場合は null、ローカル名と名前空間 URI が指定された次の要素がドキュメントの順序で配置されます。

  • メソッド MoveToFollowing を使用して属性ノードまたは名前空間ノードに移動することはできません。 XPathNavigatorパラメーターとして渡された境界が属性または名前空間ノード上に配置されている場合、その境界パラメーターは、親要素のXPathNavigator最初の子ノードに配置された境界パラメーターと同じです。 これにより、境界パラメーターが配置されている属性または名前空間ノード XPathNavigator の親要素を、このメソッドで一致させることができます。

  • メソッドが返されたMoveToFollowingfalse場合、その位置XPathNavigatorは変更されません。

適用対象

MoveToFollowing(XPathNodeType)

指定された XPathNavigator の次の要素に、XPathNodeType をドキュメント順に移動します。

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

要素の XPathNodeTypeXPathNodeType は、Attribute および Namespace にはできません。

戻り値

Boolean

XPathNavigator が正常に移動した場合は true。それ以外の場合は false

次の例では、ファイルのXPathNavigatorルートから次bookstorecontosoBooks.xml要素に移動します。

    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 ファイルを入力として使用します。

<?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)

指定されたローカル名と名前空間 URI を持つ要素に、XPathNavigator をドキュメント順に移動します。

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

要素のローカル名。

namespaceURI
String

要素の名前空間 URI。

戻り値

Boolean

XPathNavigator が正常に移動した場合は true。それ以外の場合は false

次の例では、ファイルのXPathNavigatorルートから最初pricecontosoBooks.xml要素に移動します。

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 ファイルを入力として使用します。

<?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>  

注釈

メソッドが返されたMoveToFollowingfalse場合、その位置XPathNavigatorは変更されません。

適用対象