XmlDocumentType.Notations プロパティ

定義

ドキュメント型宣言に存在する XmlNotation ノードのコレクションを取得します。Gets the collection of XmlNotation nodes present in the document type declaration.

public:
 property System::Xml::XmlNamedNodeMap ^ Notations { System::Xml::XmlNamedNodeMap ^ get(); };
public System.Xml.XmlNamedNodeMap Notations { get; }
member this.Notations : System.Xml.XmlNamedNodeMap
Public ReadOnly Property Notations As XmlNamedNodeMap

プロパティ値

XmlNamedNodeMap

XmlNotation ノードを格納している XmlNamedNodeMapAn XmlNamedNodeMap containing the XmlNotation nodes. 返された XmlNamedNodeMap は読み取り専用です。The returned XmlNamedNodeMap is read-only.

次の例では、XML ドキュメントで宣言されている表記に関する情報を表示します。The following example displays information about the notations declared in the XML document.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
void DisplayNotations( XmlNamedNodeMap^ nMap )
{
   for ( int i = 0; i < nMap->Count; i++ )
   {
      XmlNotation^ note = dynamic_cast<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();

   }
}

int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   doc->Load( "doment.xml" );
   Console::WriteLine( "Display information on all notations..." );
   XmlNamedNodeMap^ nMap = doc->DocumentType->Notations;
   DisplayNotations( nMap );
}

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();
    }
  }
}
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()
    doc.Load(filename)

    Console.WriteLine("Display information on all notations...")     
    Dim nMap as XmlNamedNodeMap = doc.DocumentType.Notations
    DisplayNotations(nMap)      
  end sub
 
  public shared sub DisplayNotations(nMap as XmlNamedNodeMap)
     Dim i as integer   
     for i = 0 to nMap.Count - 1
        Dim note as XmlNotation = CType(nMap.Item(i), XmlNotation)
        Console.Write("{0} ", note.NodeType)
        Console.Write("{0} ", note.Name)
        Console.Write("{0} ", note.PublicId)
        Console.Write("{0} ", note.SystemId)
        Console.WriteLine()
     next
  end sub            
end class

この例では、 doment.xml 入力としてファイルを使用します。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>

注釈

表記が返される順序は、これらの項目がドキュメントに表示される順序に基づいていません。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.

適用対象

こちらもご覧ください