通过


XProcessingInstruction.Data 属性

定义

获取或设置此处理指令的字符串值。

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

属性值

此处理指令的字符串值。

例外

字符串 valuenull.

示例

以下示例使用 Data 属性检索处理指令的字符串值。

XProcessingInstruction pi =
    new XProcessingInstruction("xml-stylesheet", "type='text/xsl' href='hello.xsl'");
Console.WriteLine(pi.Data);
pi.Data = "type='text/xsl' href='xform.xsl'";
Console.WriteLine(pi.Data);
Dim pi As XProcessingInstruction = <?xml-stylesheet type='text/xsl' href='hello.xsl'?>
Console.WriteLine(pi.Data)
pi.Data = "type='text/xsl' href='xform.xsl'"
Console.WriteLine(pi.Data)

此示例生成以下输出:

type='text/xsl' href='hello.xsl'
type='text/xsl' href='xform.xsl'

注解

可以使用此属性修改 XML 树。 此属性将导致事件发生。

适用于

另请参阅