Aracılığıyla paylaş


XmlEntityReference.BaseURI Özellik

Tanım

Geçerli 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

Düğümün yüklendiği konum.

Örnekler

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

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/uri.xml");

    //Display information on the entity reference node.
    XmlEntityReference entref = (XmlEntityReference) doc.DocumentElement.LastChild.FirstChild;
    Console.WriteLine("Name of the entity reference:  {0}", entref.Name);
    Console.WriteLine("Base URI of the entity reference:  {0}", entref.BaseURI);
    Console.WriteLine("The entity replacement text:  {0}", entref.InnerText);
  }
}
Imports System.IO
Imports System.Xml

public class Sample

  public shared sub Main()
  
    'Create the XmlDocument.
    Dim doc as XmlDocument = new XmlDocument()
    doc.Load("http://localhost/uri.xml")
                     
    'Display information on the entity reference node.
    Dim entref as XmlEntityReference =  CType(doc.DocumentElement.LastChild.FirstChild, XmlEntityReference) 
    Console.WriteLine("Name of the entity reference:  {0}", entref.Name)
    Console.WriteLine("Base URI of the entity reference:  {0}", entref.BaseURI)
    Console.WriteLine("The entity replacement text:  {0}", entref.InnerText)
  end sub
end class

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


<!-- XML fragment -->
<!DOCTYPE book [<!ENTITY s SYSTEM "tmp/style.xml">]>
<book genre="novel">
  <title>Pride and Prejudice</title>
  <misc>&s;</misc>
</book>

Dosya style.xml XML dizesini <style>hardcover</style>içerir.

Açıklamalar

Ağ bağlantı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üğümleri içerir. , BaseURI bu düğümlerin nereden geldiğini bildirir. Döndürülen düğümler için temel URI yoksa (bellek içi dizeden ayrıştırılmış olabilir), Empty döndürülür.

BaseURI düğüm ağacını varlık başvuru sınırlarını ararken gösterir, dolayısıyla varlıklar genişletilirse bu bilgiler korunmaz ve bu özellik her durumda XmlDocument'ın konumunu döndürür.

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

Bu özellik, Belge Nesne Modeli'nin (DOM) Bir Microsoft uzantısıdır.

Şunlara uygulanır