XmlProcessingInstruction.Target 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得處理指示的目標。
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