XPathNavigator.MoveToNextAttribute メソッド
派生クラスでオーバーライドされると、XPathNavigator を次の属性に移動します。
名前空間: System.Xml.XPath
アセンブリ: System.Xml (system.xml.dll 内)
構文
Dim instance As XPathNavigator Dim returnValue As Boolean returnValue = instance.MoveToNextAttribute
戻り値
XPathNavigator が正常に次の属性に移動された場合は true を返します。それ以上、属性が存在しない場合は false を返します。false の場合、XPathNavigator の位置は変更されません。

XPathNavigator が現在属性に配置されていない場合、このメソッドは false を返し、XPathNavigator の位置は変更されません。
XPathNavigator が属性に配置されている場合、MoveToNext、MoveToPrevious、MoveToFirst の各メソッドは適用できません。これらのメソッドは、常に false を返し、XPathNavigator の位置を変更しません。

MoveToFirstAttribute メソッドと MoveToNextAttribute メソッドを使用して、books.xml ファイル内にある各 book のすべての属性を表示する例を次に示します。
Dim document As XPathDocument = New XPathDocument("books.xml") Dim navigator As XPathNavigator = document.CreateNavigator() ' Select all book nodes and display all attributes on each book. Dim nodes As XPathNodeIterator = navigator.SelectDescendants("book", "", False) While nodes.MoveNext() Dim navigator2 As XPathNavigator = nodes.Current.Clone() navigator2.MoveToFirstAttribute() Console.WriteLine("{0} = {1}", navigator2.Name, navigator2.Value) While navigator2.MoveToNextAttribute() Console.WriteLine("{0} = {1}", navigator2.Name, navigator2.Value) End While Console.WriteLine() End While
XPathDocument document = new XPathDocument("books.xml"); XPathNavigator navigator = document.CreateNavigator(); // Select all book nodes and display all attributes on each book. XPathNodeIterator nodes = navigator.SelectDescendants("book", "", false); while (nodes.MoveNext()) { XPathNavigator navigator2 = nodes.Current.Clone(); navigator2.MoveToFirstAttribute(); Console.WriteLine("{0} = {1}", navigator2.Name, navigator2.Value); while (navigator2.MoveToNextAttribute()) { Console.WriteLine("{0} = {1}", navigator2.Name, navigator2.Value); } Console.WriteLine(); }
この例では、入力として、books.xml というファイルを使用しています。
<bookstore> <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>

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からXPathNavigator.MoveToNextAttribute メソッドを検索する場合は、下記のリンクをクリックしてください。

- XPathNavigator.MoveToNextAttribute メソッドのページへのリンク