次の方法で共有


XmlProcessingInstruction.Target プロパティ

定義

処理命令の対象を取得します。

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

プロパティ値

処理命令の対象。

次の例では、処理命令ノードを作成し、ドキュメントに追加します。

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   
   // Create a procesing instruction.
   XmlProcessingInstruction^ newPI;
   String^ PItext = "type='text/xsl' href='book.xsl'";
   newPI = doc->CreateProcessingInstruction( "xml-stylesheet", PItext );
   
   // Display the target and data information.
   Console::WriteLine( "<?{0} {1}?>", newPI->Target, newPI->Data );
   
   // Add the processing instruction node to the document.
   doc->AppendChild( newPI );
}
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
    XmlDocument doc = new XmlDocument();

    // Create a procesing instruction.
    XmlProcessingInstruction newPI;
    String PItext = "type='text/xsl' href='book.xsl'";
    newPI = doc.CreateProcessingInstruction("xml-stylesheet", PItext);

    // Display the target and data information.
    Console.WriteLine("<?{0} {1}?>", newPI.Target, newPI.Data);

    // Add the processing instruction node to the document.
    doc.AppendChild(newPI);
  }
}
Imports System.IO
Imports System.Xml

public class Sample

  public shared sub Main()
  
    Dim doc as XmlDocument = new XmlDocument()

    ' Create a procesing instruction.
    Dim newPI as XmlProcessingInstruction 
    Dim PItext as String = "type='text/xsl' href='book.xsl'"
    newPI = doc.CreateProcessingInstruction("xml-stylesheet", PItext)

    ' Display the target and data information.
    Console.WriteLine("<?{0} {1}?>", newPI.Target, newPI.Data)

    ' Add the processing instruction node to the document.
    doc.AppendChild(newPI)

  end sub
end class

適用対象