次の方法で共有


XmlEntityReference.Name プロパティ

ノードの名前を取得します。

Overrides Public ReadOnly Property Name As String
[C#]
public override string Name {get;}
[C++]
public: __property String* get_Name();
[JScript]
public override function get Name() : String;

プロパティ値

参照されたエンティティの名前。

使用例

[Visual Basic, C#, C++] エンティティ参照ノードに関する情報を表示する例を次に示します。

 
Option Explicit
Option Strict

Imports System
Imports System.IO
Imports System.Xml

Public Class Sample
    
    Public Shared Sub Main()
        ' Create the XmlDocument.
        Dim doc As New XmlDocument()
        doc.LoadXml("<!DOCTYPE book [<!ENTITY h 'hardcover'>]>" & _
                    "<book genre='novel' ISBN='1-861001-57-5'>" & _
                    "<title>Pride And Prejudice</title>" & _
                    "<style>&h;</style>" & _
                    "</book>")
        
        ' Display information on the entity reference node.
        Dim entref As XmlEntityReference = CType(doc.DocumentElement.LastChild.FirstChild, XmlEntityReference)
        Console.WriteLine("Name of the entity reference:  {0}", entref.Name)
        Console.WriteLine("The entity replacement text:  {0}", entref.InnerText)
    End Sub 'Main
End Class 'Sample

[C#] 
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
    // Create the XmlDocument.
    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<!DOCTYPE book [<!ENTITY h 'hardcover'>]>" +
                "<book genre='novel' ISBN='1-861001-57-5'>" +
                "<title>Pride And Prejudice</title>" +
                "<style>&h;</style>" +
                "</book>");

    // Display information on the entity reference node.
    XmlEntityReference entref = (XmlEntityReference) doc.DocumentElement.LastChild.FirstChild;
    Console.WriteLine("Name of the entity reference:  {0}", entref.Name);
    Console.WriteLine("The entity replacement text:  {0}", entref.InnerText);
  }
}

[C++] 
#using <mscorlib.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;

int main()
{
    // Create the XmlDocument.
    XmlDocument* doc = new XmlDocument();
    doc->LoadXml(S"<!DOCTYPE book [<!ENTITY h 'hardcover'>]>" 
                 S"<book genre='novel' ISBN='1-861001-57-5'>" 
                 S"<title>Pride And Prejudice</title>" 
                 S"<style>&h;</style>" 
                 S"</book>");

    // Display information on the entity reference node.
    XmlEntityReference* entref = dynamic_cast<XmlEntityReference*> (
        doc->DocumentElement->LastChild->FirstChild);
    Console::WriteLine(S"Name of the entity reference:  {0}", entref->Name);
    Console::WriteLine(S"The entity replacement text:  {0}", entref->InnerText);
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

XmlEntityReference クラス | XmlEntityReference メンバ | System.Xml 名前空間