XmlNodeReader.Skip メソッド
アセンブリ: System.Xml (system.xml.dll 内)


![]() |
---|
Microsoft .NET Framework version 2.0 では、XmlReaderSettings クラスと Create メソッドを使用して XmlReader インスタンスを作成することをお勧めします。これにより、.NET Framework で導入されたすべての新機能を十分に活用できます。詳細については、「XML リーダーの作成」を参照してください。 |
リーダーを "<a>" ノードまたはその属性のいずれかに配置した場合に、Skip を呼び出すと、リーダーを "<b>" ノードに配置します。
リーダーが既にリーフ ノード (要素 "x" やテキスト ノード "abc" など) に配置されている場合、Skip の呼び出しは、Read の呼び出しと同じになります。

XML ドキュメントの価格要素ノードを読み取る例を次に示します。
Option Explicit Option Strict Imports System Imports System.IO Imports System.Xml Public Class Sample Public Shared Sub Main() Dim reader As XmlNodeReader = Nothing Try 'Create and load the XML document. Dim doc As New XmlDocument() doc.LoadXml("<!-- sample XML -->" & _ "<book>" & _ "<title>Pride And Prejudice</title>" & _ "<price>19.95</price>" & _ "</book>") 'Load the XmlNodeReader reader = New XmlNodeReader(doc) reader.MoveToContent() 'Move to the book node. reader.Read() 'Read the book start tag. reader.Skip() 'Skip the title element. Console.WriteLine(reader.ReadOuterXml()) 'Read the price element. Finally If Not (reader Is Nothing) Then reader.Close() End If End Try End Sub 'Main
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlNodeReader reader = null; try { //Create and load the XML document. XmlDocument doc = new XmlDocument(); doc.LoadXml("<!-- sample XML -->" + "<book>" + "<title>Pride And Prejudice</title>" + "<price>19.95</price>" + "</book>"); //Load the XmlNodeReader reader = new XmlNodeReader(doc); reader.MoveToContent(); //Move to the book node. reader.Read(); //Read the book start tag. reader.Skip(); //Skip the title element. Console.WriteLine(reader.ReadOuterXml()); //Read the price element. } finally { if (reader != null) reader.Close(); } } } // End class
#using <System.Xml.dll> using namespace System; using namespace System::IO; using namespace System::Xml; int main() { XmlNodeReader^ reader = nullptr; try { //Create and load the XML document. XmlDocument^ doc = gcnew XmlDocument; doc->LoadXml( "<!-- sample XML -->" "<book>" "<title>Pride And Prejudice</title>" "<price>19.95</price>" "</book>" ); //Load the XmlNodeReader reader = gcnew XmlNodeReader( doc ); reader->MoveToContent(); //Move to the book node. reader->Read(); //Read the book start tag. reader->Skip(); //Skip the title element. Console::WriteLine( reader->ReadOuterXml() ); //Read the price element. } finally { if ( reader != nullptr ) reader->Close(); } }
import System.*; import System.IO.*; import System.Xml.*; public class Sample { public static void main(String[] args) { XmlNodeReader reader = null; try { //Create and load the XML document. XmlDocument doc = new XmlDocument(); doc.LoadXml("<!-- sample XML -->" + "<book>" + "<title>Pride And Prejudice</title>" + "<price>19.95</price>" + "</book>"); //Load the XmlNodeReader reader = new XmlNodeReader(doc); reader.MoveToContent(); //Move to the book node. reader.Read(); //Read the book start tag. reader.Skip(); //Skip the title element. Console.WriteLine(reader.ReadOuterXml()); //Read the price element. } finally { if (reader != null) { reader.Close(); } } } //main } //End class Sample

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


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

- XmlNodeReader.Skip メソッドのページへのリンク