XmlProcessingInstruction.Data Property

 

Gets or sets the content of the processing instruction, excluding the target.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public string Data { get; set; }

Property Value

Type: System.String

The content of the processing instruction, excluding the target.

The following example creates a processing instruction node and adds it to a document.

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);

  }
}

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show: