This documentation is archived and is not being maintained.

XmlDocumentType.Notations Property

Gets the collection of XmlNotation nodes present in the document type declaration.

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

public XmlNamedNodeMap Notations { get; }
/** @property */
public XmlNamedNodeMap get_Notations ()

public function get Notations () : XmlNamedNodeMap

Not applicable.

Property Value

An XmlNamedNodeMap containing the XmlNotation nodes. The returned XmlNamedNodeMap is read-only.

The order in which the notations are returned is not based on the order in which these items may appear in the document. The order is also not guaranteed to be the same between similar documents, or between different implementations or versions of the class.

The following example displays information about the notations 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();

    Console.WriteLine("Display information on all notations...");     
    XmlNamedNodeMap nMap = doc.DocumentType.Notations;
  public static void DisplayNotations(XmlNamedNodeMap nMap)
     for (int i=0; i < nMap.Count; i++)
        XmlNotation note = (XmlNotation) nMap.Item(i);
        Console.Write("{0} ", note.NodeType);
        Console.Write("{0} ", note.Name);
        Console.Write("{0} ", note.PublicId);
        Console.Write("{0} ", note.SystemId);

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

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

    public static void main(String[] args)
        XmlDocument doc = new XmlDocument();

        Console.WriteLine("Display information on all notations...");
        XmlNamedNodeMap nMap = doc.get_DocumentType().get_Notations();
    } //main

    public static void DisplayNotations(XmlNamedNodeMap nMap)
        for (int i = 0; i < nMap.get_Count(); i++) {
            XmlNotation note = (XmlNotation)nMap.Item(i);
            Console.Write("{0} ", note.get_NodeType());
            Console.Write("{0} ", note.get_Name());
            Console.Write("{0} ", note.get_PublicId());
            Console.Write("{0} ", note.get_SystemId());
    } //DisplayNotations
} //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 "" "coho.exe" NDATA w>
  <!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">

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