target Property
Specifies the target for the processing instruction.
strValue = oXMLDOMProcessingInstruction.target;
Example
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.3.0"); var pi; xmlDoc.async = false; xmlDoc.load("books.xml"); if (xmlDoc.parseError.errorCode != 0) { var myErr = xmlDoc.parseError; WScript.Echo("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); WScript.Echo(pi.target); } } }
strValue = oXMLDOMProcessingInstruction.target
HRESULT get_target(
BSTR *name);
Parameters
name [out, retval]
The application to which this processing instruction is directed (the target).
C/C++ Return Values
S_OK
The value returned if successful.
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.
Implemented in:
MSXML 3.0, MSXML 6.0
Show: