Export (0) Print
Expand All

XmlNotation.Name Property

Gets the name of the current node.

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

public override string Name { get; }

Property Value

Type: System.String
The name of the notation.

The following example displays information on 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();
    doc.Load(filename);

    Console.WriteLine("Display information on all notations...");     
    XmlNamedNodeMap nMap = doc.DocumentType.Notations;
    DisplayNotations(nMap);      
  }

  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);
        Console.WriteLine();
    }
  }            
}


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>


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft