The ProcessingInstruction object represents a processing instruction, which is used
in XML as a way to include processor-specific information in the text of the document.
A ProcessingInstruction consists of a target and content.
The target is the first token following the tag, while the content is that text from
the first non-white-space character after the target through the character immediately
before the '?>' which terminates the instruction.
So, for example, consider the following, typical processing instruction for an XML
document:
<?xml version="1.0"?>
The code to extract and display the type, target and content of this
ProcessingInstruction node might look something like this:
Code (JavaScript):
pi = xml_doc.firstChild;
document.write(pi.nodeType);
document.write("<br>" + pi.target);
document.write("<br>" + pi.data);
Output:
7
xml
version="1.0"
A ProcessingInstruction is also a Node object, and so inherits
various properties and methods from it. For details of the values returned by the
nodeName,
nodeType and nodeValue
properties for a ProcessingInstruction, see the Node object.
denotes a Microsoft extension to the W3C DOM.
PROPERTIES
attributes Property
This is a read-only property that returns an
NamedNodeMap for nodes that can have
attributes.
Syntax: Node.attributes
baseName Property
This is a read-only property that returns the base name for a node.
Syntax: Node.baseName
childNodes Property
This is a read-only property containing a node list of all children for those elements that
can have them.
Syntax: Node.childNodes
data Property
This is a read-only property that returns the 'content' of a ProcessingInstruction.
Syntax: ProcessingInstruction.data
dataType Property
This is a read-only property that specifies the data type for the node.
Syntax: Node.dataType
definition Property
This property returns the definition of the node in the DTD or schema.
Syntax: Node.definition
firstChild Property
This is a read-only property that returns the first child node of a node. If there is none,
it returns null.
Syntax: Node.firstChild
lastChild Property
This is a read-only property that returns the last child node of a node. If there is none,
it returns null.
Syntax: Node.lastChild
namespaceURI Property
This property is read-only and returns the URI (Universal Resource Indentifier) of the
namespace.
Syntax: Node.namespaceURI