다음을 통해 공유


XmlEntity.NodeType 속성

노드의 형식을 가져옵니다.

네임스페이스: System.Xml
어셈블리: System.Xml(system.xml.dll)

구문

‘선언
Public Overrides ReadOnly Property NodeType As XmlNodeType
‘사용 방법
Dim instance As XmlEntity
Dim value As XmlNodeType

value = instance.NodeType
public override XmlNodeType NodeType { get; }
public:
virtual property XmlNodeType NodeType {
    XmlNodeType get () override;
}
/** @property */
public XmlNodeType get_NodeType ()
public override function get NodeType () : XmlNodeType

속성 값

노드 형식입니다. XmlEntity 노드의 경우, 값은 XmlNodeType.Entity입니다.

예제

다음 예제에서는 XML 문서에서 선언된 엔터티에 대한 정보를 보여 줍니다.

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 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
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();
     }
  }
}
#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 );
}
import System.*;
import System.IO.*;
import System.Xml.*;

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

    public static void main(String[] args)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load(fileName);
        Console.WriteLine("Display information on all entities...");
        XmlNamedNodeMap nMap = doc.get_DocumentType().get_Entities();
        DisplayEntities(nMap);
    } //main

    public static void DisplayEntities(XmlNamedNodeMap nMap)
    {
        for (int i = 0; i < nMap.get_Count(); i++) {
            XmlEntity ent = (XmlEntity)nMap.Item(i);
            Console.Write("{0} ", ent.get_NodeType());
            Console.Write("{0} ", ent.get_Name());
            Console.Write("{0} ", ent.get_NotationName());
            Console.Write("{0} ", ent.get_PublicId());
            Console.Write("{0} ", ent.get_SystemId());
            Console.WriteLine();
        }
    } //DisplayEntities
} //Sample

예제에서는 doment.xml 파일을 입력으로 사용합니다.

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

플랫폼

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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

XmlEntity 클래스
XmlEntity 멤버
System.Xml 네임스페이스
XmlNodeType