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