다음을 통해 공유


target Property

 

Specifies the target for the processing instruction.

Script Syntax

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

Visual Basic Syntax

strValue = oXMLDOMProcessingInstruction.target  

C/C++ Syntax

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.

Remarks

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.

Versioning

Implemented in:

MSXML 3.0, MSXML 6.0

Applies to

IXMLDOMProcessingInstruction

See Also

nodeName Property1