Freigeben über


XmlNotation.PublicId-Eigenschaft

Ruft den Wert des öffentlichen Bezeichners für die Notationsdeklaration ab.

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

Syntax

'Declaration
Public ReadOnly Property PublicId As String
'Usage
Dim instance As XmlNotation
Dim value As String

value = instance.PublicId
public string PublicId { get; }
public:
property String^ PublicId {
    String^ get ();
}
/** @property */
public String get_PublicId ()
public function get PublicId () : String

Eigenschaftenwert

Der öffentliche Bezeichner für die Notation. Wenn kein öffentlicher Bezeichner vorhanden ist, wird NULL (Nothing in Visual Basic) zurückgegeben.

Beispiel

Im folgenden Beispiel werden Informationen über die im XML-Dokument deklarierten Notationen angezeigt.

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

        Console.WriteLine("Display information on all notations...");
        XmlNamedNodeMap nMap = doc.get_DocumentType().get_Notations();
        DisplayNotations(nMap);
    } //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());
            Console.WriteLine();
        }
    } //DisplayNotations
} //Sample

Im Beispiel wird die Datei doment.xml als Eingabe verwendet.

<!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>

Plattformen

Windows 98, Windows 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

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

XmlNotation-Klasse
XmlNotation-Member
System.Xml-Namespace
XmlDocumentType-Klasse