XPathNavigator.MoveToFollowing メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
XPathNavigatorをドキュメントの順序で指定した要素に移動します。
オーバーロード
| 名前 | 説明 |
|---|---|
| MoveToFollowing(XPathNodeType, XPathNavigator) |
XPathNavigatorを、指定したXPathNodeTypeの次の要素にドキュメントの順序で指定された境界に移動します。 |
| MoveToFollowing(String, String, XPathNavigator) |
XPathNavigatorを、ローカル名と名前空間 URI が指定された要素にドキュメントの順序で指定された境界に移動します。 |
| 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
要素の XPathNodeType 。 XPathNodeTypeをAttributeまたはNamespaceすることはできません。
- end
- XPathNavigator
現在のXPathNavigatorが次の要素を検索中に移動しない要素境界に配置されたXPathNavigator オブジェクト。
返品
true
XPathNavigatorが正常に移動した場合は。それ以外の場合はfalse。
例
次の例では、 XPathNavigator は contosoBooks.xml ファイルのルートから次の price 要素に移動されます。
XPathNavigator オブジェクトの複製は、Clone メソッドを使用して作成されます。 複製された XPathNavigatorは、 price 要素上に配置され、境界として使用されます。 複製された XPathNavigator の位置の変更は、元の XPathNavigatorには影響しません。 元のXPathNavigatorは、contosoBooks.xml メソッドを使用して、MoveToRoot ファイルのルートに戻されます。 作成者のタイトルと姓は、MoveToFollowing メソッドとXPathNodeTypeのTextを使用して取得されます。
MoveToFollowingメソッドは、price要素の境界に達するまで true を返します。
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 メソッドは、属性ノードまたは名前空間ノードに移動しません。 XPathNodeType パラメーター値がAttributeまたはNamespaceの場合、MoveToFollowing メソッドは
falseを返し、XPathNavigatorの位置は変更されません。パラメーターとして渡された XPathNavigator 境界が現在の XPathNavigator の位置の後に配置されていない場合は無視されます。
パラメーターとして渡 XPathNavigator 境界が
null場合は、指定した XPathNodeType を持つ次のノードがドキュメントの順序で配置されます。MoveToFollowing メソッドを使用して属性ノードまたは名前空間ノードに移動することはできません。 パラメーターとして渡される XPathNavigator 境界が属性ノードまたは名前空間ノード上に配置されている場合、その親要素の最初の子ノードに配置された XPathNavigator 境界パラメーターと同じです。 これにより、 XPathNavigator 境界パラメーターが配置されている属性ノードまたは名前空間ノードの親要素を、このメソッドで照合できるようになります。
MoveToFollowing メソッドが
falseを返す場合、XPathNavigatorの位置は変更されません。
適用対象
MoveToFollowing(String, String, XPathNavigator)
XPathNavigatorを、ローカル名と名前空間 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
パラメーター
- localName
- String
要素のローカル名。
- namespaceURI
- String
要素の名前空間 URI。
- end
- XPathNavigator
現在のXPathNavigatorが次の要素を検索中に移動しない要素境界に配置されたXPathNavigator オブジェクト。
返品
true
XPathNavigatorが正常に移動した場合は。それ以外の場合はfalse。
例
次の例では、 XPathNavigator は contosoBooks.xml ファイルのルートから次の book 要素に移動されます。
XPathNavigator オブジェクトの複製は、Clone メソッドを使用して作成され、book要素から次のfirst-name要素に移動されます。 複製された XPathNavigatorは、 first-name 要素上に配置され、境界として使用されます。 複製された XPathNavigator の位置の変更は、元の XPathNavigatorには影響しません。 元のXPathNavigatorは、パラメーターとして渡された境界を持つ price メソッドを使用して、次のMoveToFollowing要素への移動を試みます。 次の price 要素が境界を超えているので、この移動は失敗します。 元の XPathNavigator は、同じメソッドを使用して境界の前にある次の title 要素への移動を試み、成功します。
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 境界パラメーターが配置されている属性ノードまたは名前空間ノードの親要素を、このメソッドで照合できるようになります。
MoveToFollowing メソッドが
falseを返す場合、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
要素の XPathNodeType 。 XPathNodeTypeをAttributeまたはNamespaceすることはできません。
返品
true
XPathNavigatorが正常に移動した場合は。それ以外の場合はfalse。
例
次の例では、 XPathNavigator は contosoBooks.xml ファイルのルートから次の bookstore 要素に移動されます。
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 メソッドは、属性ノードまたは名前空間ノードに移動しません。 XPathNodeType パラメーター値がAttributeまたはNamespaceの場合、MoveToFollowing メソッドは
falseを返し、XPathNavigatorの位置は変更されません。MoveToFollowing メソッドが
falseを返す場合、XPathNavigatorの位置は変更されません。
適用対象
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。
返品
true
XPathNavigatorが正常に移動した場合は。それ以外の場合はfalse。
例
次の例では、 XPathNavigator は contosoBooks.xml ファイルのルートから最初の price 要素に移動されます。
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>
注釈
MoveToFollowing メソッドがfalseを返す場合、XPathNavigatorの位置は変更されません。