Object built-in object

Object XmlProcessingInstruction

XmlProcessingInstruction object representationxmlProcessing instructions

inheritance relationship

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<class>XmlNode|nodeType;nodeName;nodeValue;ownerDocument;parentNode;childNodes;firstChild;lastChild;previousSibling;nextSibling|hasChildNodes();normalize();cloneNode();lookupPrefix();lookupNamespaceURI();insertBefore();insertAfter();appendChild();replaceChild();removeChild()] [<this>XmlProcessingInstruction|target;data] [object] <:- [XmlNode] [XmlNode] <:- [XmlProcessingInstruction] XmlNode nodeType nodeName nodeValue ownerDocument parentNode childNodes firstChild lastChild previousSibling nextSibling hasChildNodes() normalize() cloneNode() lookupPrefix() lookupNamespaceURI() insertBefore() insertAfter() appendChild() replaceChild() removeChild() object toString() toJSON() XmlProcessingInstruction target data

Member properties

target

String, returns the target of this processing instruction

1
readonly String XmlProcessingInstruction.target;

data

String, sets or returns the content of this processing instruction

1
String XmlProcessingInstruction.data;

nodeType

Integer, returns the node type of the node

1
readonly Integer XmlProcessingInstruction.nodeType;

The nodeType of different objects will return different values:


nodeName

String, returns the name of the node, according to its type

1
readonly String XmlProcessingInstruction.nodeName;

The nodeName of different objects will return different values:


nodeValue

String, returns the name of the node, according to its type

1
String XmlProcessingInstruction.nodeValue;

The nodeName of different objects will return different values:


ownerDocument

XmlDocument, returns the root element of the node (XmlDocumentobject)

1
readonly XmlDocument XmlProcessingInstruction.ownerDocument;

parentNode

XmlNode, returns the parent node of a node

1
readonly XmlNode XmlProcessingInstruction.parentNode;

childNodes

XmlNodeList, returns a list of nodes that are children of the specified node

1
readonly XmlNodeList XmlProcessingInstruction.childNodes;

firstChild

XmlNode, returns the first child of the node

1
readonly XmlNode XmlProcessingInstruction.firstChild;

lastChild

XmlNode, returns the last child of the node

1
readonly XmlNode XmlProcessingInstruction.lastChild;

previousSibling

XmlNode, returns the node immediately before a node (at the same tree level), if there is no such node, the property returns null

1
readonly XmlNode XmlProcessingInstruction.previousSibling;

nextSibling

XmlNode, returns the node immediately after an element (in the same tree level), if there is no such node, the property returns null

1
readonly XmlNode XmlProcessingInstruction.nextSibling;

member function

hasChildNodes

Query whether there is a child node

1
Boolean XmlProcessingInstruction.hasChildNodes();

Return result:

  • Boolean, returns true if there are any child nodes, false otherwise

normalize

Merge adjacent Text nodes and delete empty Text nodes

1
XmlProcessingInstruction.normalize();

This method will iterate over all descendant nodes of the current node, normalizing the document by removing empty Text nodes, already merging all adjacent Text nodes. This method is useful for simplifying the structure of the document tree after node insertion or deletion.


cloneNode

Create an exact copy of the specified node

1
XmlNode XmlProcessingInstruction.cloneNode(Boolean deep = true);

Call parameters:

  • deep: Boolean, whether to deep copy, when true, the cloned node will clone all the child nodes of the original node

Return result:

This method will copy and return a copy of the node on which it was called. If the argument passed to it is true, it will also recursively copy all descendants of the current node. Otherwise, it just copies the current node. The returned node does not belong to the document tree and its parentNode property is null. When an Element node is copied, all its properties are copied.


lookupPrefix

Returns the prefix matching the specified namespace URI on the current node

1
String XmlProcessingInstruction.lookupPrefix(String namespaceURI);

Call parameters:

  • namespaceURI: String, specifying the matching namespace URI

Return result:

  • String, returns the matching prefix, not matching returns null

lookupNamespaceURI

Returns the namespace URI matching the specified prefix on the current node

1
String XmlProcessingInstruction.lookupNamespaceURI(String prefix);

Call parameters:

  • prefix: String, specifying the prefix to match

Return result:

  • String, returns the matching namespace URI, not matching returns null

insertBefore

Insert a new child node before an existing child node

1 2
XmlNode XmlProcessingInstruction.insertBefore(XmlNode newChild, XmlNode refChild);

Call parameters:

  • newChild:XmlNode, insert a new node
  • refChild:XmlNode, insert a new node before this node

Return result:

  • XmlNode, returns the new child node

If newChild already exists in the document tree, it will be removed from the document tree and reinserted in its new position. Nodes from one document (or nodes created by one document) cannot be inserted into another document. That is, the ownerDocument property of newChild must be the same as the current node's ownerDocument property.


insertAfter

Insert a new child node after an existing child node

1 2
XmlNode XmlProcessingInstruction.insertAfter(XmlNode newChild, XmlNode refChild);

Call parameters:

  • newChild:XmlNode, insert a new node
  • refChild:XmlNode, insert a new node after this node

Return result:

  • XmlNode, returns the new child node

If newChild already exists in the document tree, it will be removed from the document tree and reinserted in its new position. Nodes from one document (or nodes created by one document) cannot be inserted into another document. That is, the ownerDocument property of newChild must be the same as the current node's ownerDocument property.


appendChild

Add a new child node to the end of the node's child node list

1
XmlNode XmlProcessingInstruction.appendChild(XmlNode newChild);

Call parameters:

  • newChild:XmlNode, specifies the node to add

Return result:

  • XmlNode, return this new child node

If newChild already exists in the document tree, it will be removed from the document tree and reinserted in its new position. Nodes from one document (or nodes created by one document) cannot be inserted into another document. That is, the ownerDocument property of newChild must be the same as the current node's ownerDocument property.


replaceChild

replace a child node with another

1 2
XmlNode XmlProcessingInstruction.replaceChild(XmlNode newChild, XmlNode oldChild);

Call parameters:

  • newChild:XmlNode, specifies the new node
  • oldChild:XmlNode, specifies the node to be replaced

Return result:

  • XmlNode, if the replacement is successful, this method can return the node to be replaced, if the replacement fails, it will return null

If newChild already exists in the document tree, it will be removed from the document tree and reinserted in its new position. Nodes from one document (or nodes created by one document) cannot be inserted into another document. That is, the ownerDocument property of newChild must be the same as the current node's ownerDocument property.


removeChild

Remove a node from the list of child nodes

1
XmlNode XmlProcessingInstruction.removeChild(XmlNode oldChild);

Call parameters:

  • oldChild:XmlNode, specifies the node to be deleted

Return result:

  • XmlNode, if the deletion is successful, this method can return the deleted node, if it fails, it will return null

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be reimplemented according to its own characteristics

1
String XmlProcessingInstruction.toString();

Return result:

  • String, returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns the set of readable properties defined by the object

1
Value XmlProcessingInstruction.toJSON(String key = "");

Call parameters:

  • key: String, unused

Return result:

  • Value, returns a value containing JSON serializable