Partager via


XmlEntity.SystemId Propriété

Définition

Obtient la valeur de l'identificateur système sur la déclaration d'entité.

public:
 property System::String ^ SystemId { System::String ^ get(); };
public string? SystemId { get; }
public string SystemId { get; }
member this.SystemId : string
Public ReadOnly Property SystemId As String

Valeur de propriété

Identificateur système sur l'entité. S'il n'existe aucun identificateur système, null est alors retournée.

Exemples

L’exemple suivant affiche des informations sur les entités déclarées dans le document XML.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
public ref class Sample
{
public:
   static void DisplayEntities( XmlNamedNodeMap^ nMap )
   {
      for ( int i = 0; i < nMap->Count; i++ )
      {
         XmlEntity^ ent = dynamic_cast<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();

      }
   }

};

int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   doc->Load( "doment.xml" );
   Console::WriteLine( "Display information on all entities..." );
   XmlNamedNodeMap^ nMap = doc->DocumentType->Entities;
   Sample^ MySample = gcnew Sample;
   MySample->DisplayEntities( 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 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();
     }
  }
}
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 entities...")     
     Dim nMap as XmlNamedNodeMap = doc.DocumentType.Entities
     DisplayEntities(nMap)
  end sub
 
  public shared sub DisplayEntities(nMap as XmlNamedNodeMap)
     Dim i as integer   
     for i = 0 to nMap.Count - 1
        Dim ent as XmlEntity = CType(nMap.Item(i), XmlEntity)
        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()
     next
  end sub
end class

L’exemple utilise le fichier doment.xml comme entrée.

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

S’applique à

Voir aussi