XProcessingInstruction.Data Property

Definition

Gets or sets the string value of this processing instruction.

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

Property Value

A String that contains the string value of this processing instruction.

Exceptions

The string value is null.

Examples

The following example uses the Data property to retrieve the string value of a processing instruction.

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)  

This example produces the following output:

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

Remarks

You can use this property to modify an XML tree. This property will cause events to occur.

Applies to

See also