Specifies the target for the processing instruction.
strValue = oXMLDOMProcessingInstruction.target;
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 target.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
var pi;
xmlDoc.async = false;
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.target);
}
}
}
strValue = oXMLDOMProcessingInstruction.target
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 target.
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.Target
End If
Next
HRESULT get_target(
BSTR *name);
String. The property is read-only. XML defines the target as the first token following the markup that begins the processing instruction. For example, the target has the value "xml" in the processing instruction <?xml version="1.0">.
The target property has the same value as the nodeName 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