ObjectXmlProcessingInstruction
XmlProcessingInstruction object representationxmlprocessing instructions
inheritance relationship
member attribute
target
String, returns the target of this processing instruction
1readonly String XmlProcessingInstruction.target;
data
String, set or return the content of this processing instruction
1String XmlProcessingInstruction.data;
nodeType
Integer, the node type of the returned node
1readonly Integer XmlProcessingInstruction.nodeType;
The nodeType of different objects will return different values:
- XmlElement: ELEMENT_NODE(1)
- XmlAttr: ATTRIBUTE_NODE(2)
- XmlText: TEXT_NODE(3)
- XmlCDATASection: CDATA_SECTION_NODE(4)
- XmlProcessingInstruction: PROCESSING_INSTRUCTION_NODE(7)
- XmlComment: COMMENT_NODE(8)
- XmlDocument: DOCUMENT_NODE(9)
- XmlDocumentType: DOCUMENT_TYPE_NODE(10)
nodeName
String, returns the name of the node, according to its type
1readonly String XmlProcessingInstruction.nodeName;
The nodeName of different objects will return different values:
- XmlElement: element name
- XmlAttr: property name
- XmlText: #text
- XmlCDATASection: #cdata-section
- XmlProcessingInstruction: Returns the specified target target
- XmlComment: #comment
- XmlDocument: #document
- XmlDocumentType: doctype name
nodeValue
String, returns the name of the node, according to its type
1String XmlProcessingInstruction.nodeValue;
The nodeName of different objects will return different values:
- XmlElement: null
- XmlAttr: the value of the attribute
- XmlText: the content of the node
- XmlCDATASection: the content of the node
- XmlProcessingInstruction: Return the specified content data
- XmlComment: comment text
- XmlDocument: null
- XmlDocumentType: null
ownerDocument
XmlDocument, returns the root element of the node (XmlDocumentobject)
1readonly XmlDocument XmlProcessingInstruction.ownerDocument;
parentNode
XmlNode, which returns the parent node of a node
1readonly XmlNode XmlProcessingInstruction.parentNode;
childNodes
XmlNodeList, returns a list of nodes that are children of the specified node
1readonly XmlNodeList XmlProcessingInstruction.childNodes;
firstChild
XmlNode, returns the first child node of the node
1readonly XmlNode XmlProcessingInstruction.firstChild;
lastChild
XmlNode, returns the last child node of the node
1readonly XmlNode XmlProcessingInstruction.lastChild;
previousSibling
XmlNode, returns the node immediately before a node (at the same tree level), if there is no such node, then this property returns null
1readonly XmlNode XmlProcessingInstruction.previousSibling;
nextSibling
XmlNode, returns the node immediately following an element (in the same tree hierarchy), if there is no such node, the property returns null
1readonly XmlNode XmlProcessingInstruction.nextSibling;
member function
hasChildNodes
Query whether there are child nodes
1Boolean XmlProcessingInstruction.hasChildNodes();
return result:
- Boolean, returns true if there are any child nodes, otherwise returns false
normalize
Merge adjacent Text nodes and delete empty Text nodes
1XmlProcessingInstruction.normalize();
This method will iterate over all descendants of the current node, normalize the document by removing empty Text nodes, and merging all adjacent Text nodes. This method is useful for simplifying the structure of the document tree after inserting or deleting nodes.
cloneNode
Create an exact copy of the specified node
1XmlNode XmlProcessingInstruction.cloneNode(Boolean deep = true);
Call parameters:
- deep: Boolean, whether to deep copy, when true, the cloned node will clone all child nodes of the original node
return result:
- XmlNode, returns the copied node
This method will copy and return a copy of the node on which it was called. If the parameter passed to it is true, it will also recursively copy all descendant nodes 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 copying an Element node, all its attributes will be copied.
lookupPrefix
Returns the prefixes matching the specified namespace URI on the current node
1String XmlProcessingInstruction.lookupPrefix(String namespaceURI);
Call parameters:
- namespaceURI: String, specifies the matching namespace URI
return result:
- String, returns the matching prefix, returns null if not matched
lookupNamespaceURI
Returns the namespace URIs matching the specified prefix on the current node
1String XmlProcessingInstruction.lookupNamespaceURI(String prefix);
Call parameters:
- prefix: String, specifies the matching prefix
return result:
- String, returns the matched namespace URI, returns null if not matched
insertBefore
Insert a new child node before an existing child node
1
2XmlNode XmlProcessingInstruction.insertBefore(XmlNode newChild,
XmlNode refChild);
Call parameters:
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 from one document) cannot be inserted into another document. That is, newChild's ownerDocument property must be the same as the current node's ownerDocument property.
insertAfter
Insert a new child node after an existing child node
1
2XmlNode XmlProcessingInstruction.insertAfter(XmlNode newChild,
XmlNode refChild);
Call parameters:
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 from one document) cannot be inserted into another document. That is, newChild's ownerDocument property must be the same as the current node's ownerDocument property.
appendChild
Adds a new child node to the end of the node's child node list
1XmlNode XmlProcessingInstruction.appendChild(XmlNode newChild);
Call parameters:
- newChild:XmlNode, specifies the added node
return result:
- XmlNode, returns 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 from one document) cannot be inserted into another document. That is, newChild's ownerDocument property must be the same as the current node's ownerDocument property.
replaceChild
Replace a child node with another
1
2XmlNode XmlProcessingInstruction.replaceChild(XmlNode newChild,
XmlNode oldChild);
Call parameters:
return result:
- XmlNode, if the replacement is successful, this method can return the replaced node, 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 from one document) cannot be inserted into another document. That is, newChild's ownerDocument property must be the same as the current node's ownerDocument property.
removeChild
Remove a node from the child node list
1XmlNode XmlProcessingInstruction.removeChild(XmlNode oldChild);
Call parameters:
- oldChild:XmlNode, specifying 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
Return the string representation of the object, generally return "[Native Object]", the object can be reimplemented according to its own characteristics
1String XmlProcessingInstruction.toString();
return result:
- String, returns a string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns a collection of readable properties defined by the object
1Value XmlProcessingInstruction.toJSON(String key = "");
Call parameters:
- key: String, not used
return result:
- Value, which returns a JSON-serializable value