XmlAttribute.BaseURI Özellik

Tanım

Düğümün temel Tekdüzen Kaynak Tanımlayıcısını (URI) alır.

public:
 virtual property System::String ^ BaseURI { System::String ^ get(); };
public override string BaseURI { get; }
member this.BaseURI : string
Public Overrides ReadOnly Property BaseURI As String

Özellik Değeri

String

Düğümün yüklendiği konum veya düğümde temel URI yoksa String.Empty. Öznitelik düğümleri sahip öğesiyle aynı temel URI'ye sahiptir. Öznitelik düğümünde sahip öğesi yoksa String.Empty BaseURI döndürür.

Örnekler

Aşağıdaki örnek, temel URI'si de dahil olmak üzere öznitelik düğümüyle ilgili bilgileri görüntüler.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   
   //Create the XmlDocument.
   XmlDocument^ doc = gcnew XmlDocument;
   doc->Load( "http://localhost/baseuri.xml" );
   
   //Display information on the attribute node. The value
   //returned for BaseURI is 'http://localhost/baseuri.xml'.
   XmlAttribute^ attr = doc->DocumentElement->Attributes[ 0 ];
   Console::WriteLine( "Name of the attribute:  {0}", attr->Name );
   Console::WriteLine( "Base URI of the attribute:  {0}", attr->BaseURI );
   Console::WriteLine( "The value of the attribute:  {0}", attr->InnerText );
}
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
    //Create the XmlDocument.
    XmlDocument doc = new XmlDocument();
    doc.Load("http://localhost/baseuri.xml");

    //Display information on the attribute node. The value
    //returned for BaseURI is 'http://localhost/baseuri.xml'.
    XmlAttribute attr = doc.DocumentElement.Attributes[0];
    Console.WriteLine("Name of the attribute:  {0}", attr.Name);
    Console.WriteLine("Base URI of the attribute:  {0}", attr.BaseURI);
    Console.WriteLine("The value of the attribute:  {0}", attr.InnerText);
  }
}
Option Explicit
Option Strict

Imports System.IO
Imports System.Xml

Public Class Sample
    
    Public Shared Sub Main()
        'Create the XmlDocument.
        Dim doc As New XmlDocument()
        doc.Load("http://localhost/baseuri.xml")
        
        'Display information on the attribute node. The value
        'returned for BaseURI is 'http://localhost/baseuri.xml'.
        Dim attr As XmlAttribute = doc.DocumentElement.Attributes(0)
        Console.WriteLine("Name of the attribute:  {0}", attr.Name)
        Console.WriteLine("Base URI of the attribute:  {0}", attr.BaseURI)
        Console.WriteLine("The value of the attribute:  {0}", attr.InnerText)
    End Sub
End Class

Örnek, baseuri.xmlgiriş olarak dosyasını kullanır.


<!-- XML fragment -->
<book genre="novel">
  <title>Pride And Prejudice</title>
</book>

Açıklamalar

Ağa bağlı XML belgesi, çeşitli World Wide Web Consortium (W3C) standart ekleme mekanizmaları kullanılarak toplanan veri öbeklerinden oluşur ve bu nedenle farklı yerlerden gelen düğümler içerir. bu BaseURI düğümlerin nereden geldiğini söyler.

Diğer düğüm türleriyle nasıl davrandığını ve nasıl davrandığını öğrenmek BaseURI için bkz XmlNode.BaseURI. .

Bu özellik, Belge Nesne Modeli(DOM) için bir Microsoft uzantısıdır.

Şunlara uygulanır

Ayrıca bkz.