XmlProcessingInstruction.Data Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the content of the processing instruction, excluding the target.
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
The content of the processing instruction, excluding the target.
Examples
The following example creates a processing instruction node and adds it to a document.
#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
Applies to
Vertu í samstarfi við okkur á GitHub
Heimildina fyrir þetta efni er að finna á GitHub, þar sem þú getur líka búið til og farið yfir vandamál og sameinað beiðnir. Frekari upplýsingar er að finna í framlagshandbók okkar.