XmlNodeReader.BaseURI プロパティ
アセンブリ: System.Xml (system.xml.dll 内)


![]() |
---|
Microsoft .NET Framework version 2.0 では、XmlReaderSettings クラスと Create メソッドを使用して XmlReader インスタンスを作成することをお勧めします。これにより、.NET Framework で導入されたすべての新機能を十分に活用できます。詳細については、「XML リーダーの作成」を参照してください。 |
ネットワーク化した XML ドキュメントは、さまざまな W3C 標準包含機構を使用して集約されたデータのチャンクで構成されるため、異なる場所からのノードを含んでいます。DTD エンティティは、この一例ですが、これは DTD だけに限定されていません。ベース URI は、ノードが存在していた元の位置を通知します。返されているノードのベース URI がない場合 (インメモリ文字列から解析された場合など) は、String.Empty が返されます。

ファイルを解析し、各ノードのベース URI を表示する例を次に示します。
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 an XmlDocument. Dim doc As New XmlDocument() doc.Load("http://localhost/uri.xml") reader = New XmlNodeReader(doc) 'Parse the file and display the base URI for each node. While reader.Read() Console.WriteLine("({0}) {1}", reader.NodeType, reader.BaseURI) End While Finally If Not (reader Is Nothing) Then reader.Close() End If End Try End Sub 'Main End Class 'Sample
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlNodeReader reader = null; try { //Create and load an XmlDocument. XmlDocument doc = new XmlDocument(); doc.Load("http://localhost/uri.xml"); reader = new XmlNodeReader(doc); //Parse the file and display the base URI for each node. while (reader.Read()) { Console.WriteLine("({0}) {1}", reader.NodeType, reader.BaseURI); } } 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 an XmlDocument. XmlDocument^ doc = gcnew XmlDocument; doc->Load( "http://localhost/uri.xml" ); reader = gcnew XmlNodeReader( doc ); //Parse the file and display the base URI for each node. while ( reader->Read() ) { Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI ); } } 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 an XmlDocument. XmlDocument doc = new XmlDocument(); doc.Load("http://localhost/uri.xml"); reader = new XmlNodeReader(doc); //Parse the file and display the base URI for each node. while (reader.Read()) { Console.WriteLine("({0}) {1}", reader.get_NodeType(), reader.get_BaseURI()); } } 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.BaseURI プロパティを検索する場合は、下記のリンクをクリックしてください。

- XmlNodeReader.BaseURI プロパティのページへのリンク