This documentation is archived and is not being maintained.

XmlEntity.NotationName Property

Gets the name of the optional NDATA attribute on the entity declaration.

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

public string NotationName { get; }
/** @property */
public String get_NotationName ()

public function get NotationName () : String

Not applicable.

Property Value

The name of the NDATA attribute. If there is no NDATA, a null reference (Nothing in Visual Basic) is returned.

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

using System;
using System.IO;
using System.Xml;
 
public class Sample
{
  private const String filename = "doment.xml";
 
  public static void Main()
  {      
     XmlDocument doc = new XmlDocument();
     doc.Load(filename);
 
     Console.WriteLine("Display information on all entities...");     
     XmlNamedNodeMap nMap = doc.DocumentType.Entities;
     DisplayEntities(nMap);
  }
 
  public static void DisplayEntities(XmlNamedNodeMap nMap)
  {    
     for (int i=0; i < nMap.Count; i++)
     {
        XmlEntity ent = (XmlEntity) nMap.Item(i);
        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);
        Console.WriteLine();
     }
  }
}

import System.*;
import System.IO.*;
import System.Xml.*;

public class Sample
{
    static private String fileName = "doment.xml";

    public static void main(String[] args)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load(fileName);
        Console.WriteLine("Display information on all entities...");
        XmlNamedNodeMap nMap = doc.get_DocumentType().get_Entities();
        DisplayEntities(nMap);
    } //main

    public static void DisplayEntities(XmlNamedNodeMap nMap)
    {
        for (int i = 0; i < nMap.get_Count(); i++) {
            XmlEntity ent = (XmlEntity)nMap.Item(i);
            Console.Write("{0} ", ent.get_NodeType());
            Console.Write("{0} ", ent.get_Name());
            Console.Write("{0} ", ent.get_NotationName());
            Console.Write("{0} ", ent.get_PublicId());
            Console.Write("{0} ", ent.get_SystemId());
            Console.WriteLine();
        }
    } //DisplayEntities
} //Sample

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">
    something
</doc>

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: