XmlEntity.Name Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the name of the node.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

Public Overrides ReadOnly Property Name As String

Property Value

Type: System.String

The name of the entity.

The following example displays information on the entities declared in the XML document.

Imports System
Imports System.IO
Imports System.Xml

public class Sample

  private const filename as String = "doment.xml"

  public shared sub Main()

     Dim doc as XmlDocument = new XmlDocument()

     Console.WriteLine("Display information on all entities...")     
     Dim nMap as XmlNamedNodeMap = doc.DocumentType.Entities
  end sub

  public shared sub DisplayEntities(nMap as XmlNamedNodeMap)
     Dim i as integer   
     for i = 0 to nMap.Count - 1
        Dim ent as XmlEntity = CType(nMap.Item(i), XmlEntity)
        Console.Write("{0} ", ent.NodeType)
        Console.Write("{0} ", ent.Name)
        Console.Write("{0} ", ent.NotationName)
        Console.Write("{0} ", ent.PublicId)
        Console.Write("{0} ", ent.SystemId)
  end sub
end class

The example uses the file doment.xml as input.

<!DOCTYPE doc [

  <!ELEMENT doc ANY>

  <!NOTATION w SYSTEM "wine.exe">
  <!NOTATION v PUBLIC "vine.exe">

  <!NOTATION jpg PUBLIC "Jpeg picture format">
  <!NOTATION gif SYSTEM "Gif picture format">

  <!ENTITY wn PUBLIC "http://www.cohowinery.com" "coho.exe" NDATA w>
  <!ENTITY vn SYSTEM "http://www.cohovineyard.com" NDATA v>
  <!ENTITY mytxt "Text Sample">

  <!ATTLIST doc 
        src     ENTITY         #IMPLIED
        srcs    ENTITIES       #IMPLIED
        jpgPic  NOTATION (jpg) #IMPLIED
        gifPic  NOTATION (gif) #REQUIRED>

<doc jpgPic="jpg" gifPic="gif" srcs="vn wn">

.NET Framework
Available since 1.1
Return to top