Retrieves and sets the content of the processing instruction, excluding the target.
strValue = oXMLDOMProcessingInstruction.data; objXMLDOMProcessingInstruction.data = strValue;
The following script example iterates through the document's child nodes. If it finds a node of type NODE_PROCESSING_INSTRUCTION (7), it displays the node's data.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
var pi;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode <> 0) {
var myErr = xmlDoc.parseError;
alert("You have error " + myErr.reason);
} else {
for (var i=0; i<xmlDoc.childNodes.length; i++) {
if (xmlDoc.childNodes.item(i).nodeType == 7) {
pi = xmlDoc.childNodes.item(i);
alert(pi.data);
}
}
}
strValue = oXMLDOMProcessingInstruction.data objXMLDOMProcessingInstruction.data = strValue
The following Microsoft® Visual Basic® example iterates through the document's child nodes. If it finds a node of type NODE_PROCESSING_INSTRUCTION (7), it displays the node's data.
Dim xmlDoc As New Msxml2.DOMDocument50
Dim pi As IXMLDOMProcessingInstruction
xmlDoc.Load ("books.xml")
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
MsgBox("You have error " & myErr.reason)
Else
For i = 0 To (xmlDoc.childNodes.length - 1)
If xmlDoc.childNodes.Item(i).nodeType = _
NODE_PROCESSING_INSTRUCTION Then
Set pi = xmlDoc.childNodes.Item(i)
MsgBox pi.Data
End If
Next
End If
HRESULT get_data(
BSTR *value);
HRESULT put_data(
BSTR value);
nodeValue property.String. This property is read/write. The data has the same value as the nodeValue property.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button
in the upper-left corner of the page.
Applies to: IXMLDOMProcessingInstruction