XmlProcessingInstruction.Data 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定處理指示的內容,目標除外。
public:
property System::String ^ Data { System::String ^ get(); void set(System::String ^ value); };
public string Data { get; set; }
member this.Data : string with get, set
Public Property Data 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