XPathNavigator.MoveToFollowing Methode

Definition

Positioniert den XPathNavigator auf das nächste Element in Dokumentreihenfolge.

Überlädt

MoveToFollowing(XPathNodeType, XPathNavigator)

Verschiebt den XPathNavigator in Dokumentreihenfolge bis zur angegebenen Begrenzung zum folgenden Element vom angegebenen XPathNodeType.

MoveToFollowing(String, String, XPathNavigator)

Verschiebt den XPathNavigator in Dokumentreihenfolge bis zur angegebenen Begrenzung auf das Element mit dem angegebenen lokalen Namen und Namespace-URI.

MoveToFollowing(XPathNodeType)

Verschiebt den XPathNavigator auf das folgende Element vom angegebenen XPathNodeType in Dokumentreihenfolge.

MoveToFollowing(String, String)

Verschiebt den XPathNavigator in Dokumentreihenfolge auf das Element mit dem angegebenen lokalen Namen und Namespace-URI.

MoveToFollowing(XPathNodeType, XPathNavigator)

Source:
XPathNavigator.cs
Source:
XPathNavigator.cs
Source:
XPathNavigator.cs

Verschiebt den XPathNavigator in Dokumentreihenfolge bis zur angegebenen Begrenzung zum folgenden Element vom angegebenen 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

Parameter

type
XPathNodeType

Der XPathNodeType des Elements. Der XPathNodeType darf nicht Attribute oder Namespace sein.

end
XPathNavigator

Das XPathNavigator-Objekt, positioniert auf der Elementbegrenzung, über die der aktuelle XPathNavigator bei der Suche nach dem folgenden Element nicht hinausgeht.

Gibt zurück

true, wenn der XPathNavigator verschoben werden konnte, andernfalls false.

Beispiele

Im folgenden Beispiel wird die XPathNavigator vom Stamm der contosoBooks.xml Datei in das folgende price Element verschoben. Ein Klon des XPathNavigator Objekts wird mithilfe der Clone -Methode erstellt. Die geklonte XPathNavigator, die auf dem price -Element positioniert ist, wird als Grenze verwendet. Änderungen an der Position des geklonten XPathNavigator haben keine Auswirkungen auf die ursprüngliche XPathNavigator. Das Original XPathNavigator wird mithilfe der -Methode zurück in den MoveToRoot Stamm der contosoBooks.xml Datei verschoben. Der Titel und der Vor- und Nachname des Autors werden mithilfe der MoveToFollowing -Methode und eines XPathNodeType von Textabgerufen. Die MoveToFollowing -Methode gibt true zurück, bis die price Elementgrenze erreicht ist.

    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

In diesem Beispiel wird die Datei contosoBooks.xml als Eingabe verwendet.

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

Hinweise

  • Die MoveToFollowing -Methode wird nicht zu Attribut- oder Namespaceknoten verschoben. Wenn der XPathNodeType Parameterwert oder NamespaceistAttribute, gibt die MoveToFollowing Methode zurückfalse, und die Position des XPathNavigator ist unverändert.

  • Wenn die XPathNavigator als Parameter übergebene Grenze nicht nach der Position des aktuellen XPathNavigator positioniert ist, wird sie ignoriert.

  • Wenn XPathNavigator die grenze als Parameter übergeben wird, befindet null sich der nächste folgende Knoten mit dem angegebenen XPathNodeType in der Dokumentreihenfolge.

  • Die MoveToFollowing Methoden können nicht verwendet werden, um zu Attribut- oder Namespaceknoten zu wechseln. Wenn die XPathNavigator als Parameter übergebene Grenze über einem Attribut- oder Namespaceknoten positioniert wird, entspricht sie dem XPathNavigator Boundary-Parameter, der auf dem ersten untergeordneten Knoten des übergeordneten Elements positioniert wurde. Dadurch wird sichergestellt, dass das übergeordnete Element des Attributs oder Namespaceknotens, auf dem der XPathNavigator Begrenzungsparameter positioniert ist, von dieser Methode abgeglichen werden kann.

  • Wenn die MoveToFollowing -Methode zurückgibt false, bleibt die Position des XPathNavigator unverändert.

Gilt für:

MoveToFollowing(String, String, XPathNavigator)

Source:
XPathNavigator.cs
Source:
XPathNavigator.cs
Source:
XPathNavigator.cs

Verschiebt den XPathNavigator in Dokumentreihenfolge bis zur angegebenen Begrenzung auf das Element mit dem angegebenen lokalen Namen und Namespace-URI.

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

Parameter

localName
String

Der lokale Name des Elements.

namespaceURI
String

Der Namespace-URI des Elements.

end
XPathNavigator

Das XPathNavigator-Objekt, positioniert auf der Elementbegrenzung, über die der aktuelle XPathNavigator bei der Suche nach dem folgenden Element nicht hinausgeht.

Gibt zurück

true, wenn der XPathNavigator verschoben werden konnte, andernfalls false.

Beispiele

Im folgenden Beispiel wird die XPathNavigator vom Stamm der contosoBooks.xml Datei in das folgende book Element verschoben. Ein Klon des XPathNavigator Objekts wird mithilfe der Clone -Methode erstellt und vom book -Element in das folgende first-name Element verschoben. Die geklonte XPathNavigator, die auf dem first-name -Element positioniert ist, wird als Grenze verwendet. Änderungen an der Position des geklonten XPathNavigator haben keine Auswirkungen auf die ursprüngliche XPathNavigator. Das Original XPathNavigator versucht dann, mithilfe der -Methode mit der als Parameter übergebenen Grenze zum folgenden price Element MoveToFollowing zu wechseln. Diese Verschiebung schlägt fehl, da das folgende price Element die Grenze überschreitet. Das Original XPathNavigator versucht dann, mit der gleichen Methode zum folgenden title Element zu wechseln, das vor der Grenze liegt und erfolgreich ist.

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)

In diesem Beispiel wird die Datei contosoBooks.xml als Eingabe verwendet.

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

Hinweise

  • Wenn die XPathNavigator als Parameter übergebene Grenze nicht nach der Position des aktuellen XPathNavigator positioniert ist, wird sie ignoriert.

  • Wenn der XPathNavigator Boundary-Parameter ist, befindet nullsich das folgende Element mit dem angegebenen lokalen Namen und Namespace-URI in der Dokumentreihenfolge.

  • Die MoveToFollowing Methoden können nicht verwendet werden, um zu Attribut- oder Namespaceknoten zu wechseln. Wenn die XPathNavigator als Parameter übergebene Grenze über einem Attribut- oder Namespaceknoten positioniert wird, entspricht sie dem XPathNavigator Boundary-Parameter, der auf dem ersten untergeordneten Knoten des übergeordneten Elements positioniert wurde. Dadurch wird sichergestellt, dass das übergeordnete Element des Attributs oder Namespaceknotens, auf dem der XPathNavigator Begrenzungsparameter positioniert ist, von dieser Methode abgeglichen werden kann.

  • Wenn die MoveToFollowing -Methode zurückgibt false, bleibt die Position des XPathNavigator unverändert.

Gilt für:

MoveToFollowing(XPathNodeType)

Source:
XPathNavigator.cs
Source:
XPathNavigator.cs
Source:
XPathNavigator.cs

Verschiebt den XPathNavigator auf das folgende Element vom angegebenen XPathNodeType in Dokumentreihenfolge.

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

Parameter

type
XPathNodeType

Der XPathNodeType des Elements. Der XPathNodeType darf nicht Attribute oder Namespace sein.

Gibt zurück

true, wenn der XPathNavigator verschoben werden konnte, andernfalls false.

Beispiele

Im folgenden Beispiel wird die XPathNavigator vom Stamm der contosoBooks.xml Datei in das folgende bookstore Element verschoben.

    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)

In diesem Beispiel wird die Datei contosoBooks.xml als Eingabe verwendet.

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

Hinweise

Gilt für:

MoveToFollowing(String, String)

Source:
XPathNavigator.cs
Source:
XPathNavigator.cs
Source:
XPathNavigator.cs

Verschiebt den XPathNavigator in Dokumentreihenfolge auf das Element mit dem angegebenen lokalen Namen und Namespace-URI.

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

Parameter

localName
String

Der lokale Name des Elements.

namespaceURI
String

Der Namespace-URI des Elements.

Gibt zurück

true, wenn der XPathNavigator verschoben werden konnte, andernfalls false.

Beispiele

Im folgenden Beispiel wird vom XPathNavigator Stamm contosoBooks.xml der Datei in das erste price Element verschoben.

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)

In diesem Beispiel wird die Datei contosoBooks.xml als Eingabe verwendet.

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

Hinweise

Wenn die MoveToFollowing -Methode zurückgibt false, bleibt die Position des XPathNavigator unverändert.

Gilt für: