Object built-in object

Object XmlCDATASection

The XmlCDATASection object represents the CDATA section in the document

The XmlCDATASection interface is XmlTextThe sub-interface of the interface does not define any properties and methods of its own. Pass fromXmlNode The interface inherits the nodeValue property, or through XmlCharacterData The interface inherits the data attribute and can access the text content of the CDATA Section.

Although the XmlCDATASection node can usually be used as XmlText Node processing, but pay attention XmlNode The normalize method does not incorporate the adjacent CDATA section.

use XmlDocument The createXmlCDATASection method to create an XmlCDATASection.

The CDATA section contains text that will not be parsed by the parser. The tags in the CDATA section will not be considered as markers, and the entities will not be expanded. The main purpose is to include material such as XML fragments without having to escape all the separators.

The only delimiter recognized in a CDATA is "]]>", which can mark the end of the CDATA section. CDATA sections cannot be nested.

Inheritance

#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()] [<class>XmlCharacterData|data;length|substringData();appendData();insertData();deleteData();replaceData()] [<class>XmlText|splitText()] [<this>XmlCDATASection] [object] <:- [XmlNode] [XmlNode] <:- [XmlCharacterData] [XmlCharacterData] <:- [XmlText] [XmlText] <:- [XmlCDATASection] XmlNode nodeType nodeName nodeValue ownerDocument parentNode childNodes firstChild lastChild previousSibling nextSibling hasChildNodes() normalize() cloneNode() lookupPrefix() lookupNamespaceURI() insertBefore() insertAfter() appendChild() replaceChild() removeChild() XmlCharacterData data length substringData() appendData() insertData() deleteData() replaceData() object toString() toJSON() XmlText splitText() XmlCDATASection

Member attributes

data

String, the text contained in the node

1
String XmlCDATASection.data;

length

Integer, the number of characters contained in the node

1
readonly Integer XmlCDATASection.length;

nodeType

Integer, returns the node type of the node

1
readonly Integer XmlCDATASection.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 XmlCDATASection.nodeName;

The nodeName of different objects will return different values:


nodeValue

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

1
String XmlCDATASection.nodeValue;

The nodeName of different objects will return different values:


ownerDocument

XmlDocument, Returns the root element of the node (XmlDocument Object)

1
readonly XmlDocument XmlCDATASection.ownerDocument;

parentNode

XmlNode, Can return the parent node of a node

1
readonly XmlNode XmlCDATASection.parentNode;

childNodes

XmlNodeList, Returns the node list of the child nodes of the specified node

1
readonly XmlNodeList XmlCDATASection.childNodes;

firstChild

XmlNode, Return the first child node of the node

1
readonly XmlNode XmlCDATASection.firstChild;

lastChild

XmlNode, Return the last child node of the node

1
readonly XmlNode XmlCDATASection.lastChild;

previousSibling

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

1
readonly XmlNode XmlCDATASection.previousSibling;

nextSibling

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

1
readonly XmlNode XmlCDATASection.nextSibling;

Member function

splitText

Split the text node into two nodes according to the specified offset

1
XmlText XmlCDATASection.splitText(Integer offset);

Call parameters:

  • offset: Integer, specifies where to split the text node. Start value starts at 0

Return result:

  • XmlText, Text node split from the current node

This method will put XmlTextThe node is split into two nodes. originalXmlTextThe node will be modified so that it contains the text content before the position specified by the offset (but not including the text content). newXmlTextThe node will be created to store all characters from the offset position (including the character at that position) to the end of the original character. newXmlTextThe node is the return value of the method. In addition, if the originalXmlText Node has parentNode, new XmlText The node will be inserted into this parent node, immediately after the original node.

XmlCDATASection interface inherits XmlText Interface, XmlCDATASection node can also use this method, but the newly created node is XmlCDATASection node instead of XmlText node.


substringData

Extract substring from node

1 2
String XmlCDATASection.substringData(Integer offset, Integer count);

Call parameters:

  • offset: Integer, the position of the first character to be returned
  • count: Integer, the number of characters in the substring to be returned

Return result:

  • String, Return the extracted string

appendData

Append the string to the node

1
XmlCDATASection.appendData(String arg);

Call parameters:

  • arg: String, the string to be appended to the node

insertData

Insert string into node

1 2
XmlCDATASection.insertData(Integer offset, String arg);

Call parameters:

  • offset: Integer, the character position where the string is to be inserted into the node
  • arg: String, the string to be inserted

deleteData

Delete text from node

1 2
XmlCDATASection.deleteData(Integer offset, Integer count);

Call parameters:

  • offset: Integer, the position of the first character to be deleted
  • count: Integer, the number of characters to delete

replaceData

Replace the characters of the node with the specified string

1 2 3
XmlCDATASection.replaceData(Integer offset, Integer count, String arg);

Call parameters:

  • offset: Integer, the character position of the node to be replaced
  • count: Integer, the number of characters to be replaced
  • arg: String, the string to be inserted

hasChildNodes

Query whether there are child nodes

1
Boolean XmlCDATASection.hasChildNodes();

Return result:

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

normalize

Merge adjacent Text nodes and delete empty Text nodes

1
XmlCDATASection.normalize();

This method will traverse all descendant nodes of the current node, and normalize the document by deleting the empty Text node 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

1
XmlNode XmlCDATASection.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:

This method will copy and return a copy of the node that called it. If the parameter passed to it is true, it will also recursively copy all descendants of the current node. Otherwise, it only copies the current node. The returned node does not belong to the document tree, and its parentNode property is null. When the Element node is copied, all its attributes will be copied.


lookupPrefix

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

1
String XmlCDATASection.lookupPrefix(String namespaceURI);

Call parameters:

  • namespaceURI: String, specify the matching namespace URI

Return result:

  • String, Returns the matched prefix, returns null if it is not matched

lookupNamespaceURI

Returns the namespace URI that matches the specified prefix on the current node

1
String XmlCDATASection.lookupNamespaceURI(String prefix);

Call parameters:

  • prefix: String, specify the matching prefix

Return result:

  • String, Returns the matching namespace URI, returns null if it is not matched

insertBefore

Insert a new child node before the existing child node

1 2
XmlNode XmlCDATASection.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, Return the new child node

If newChild already exists in the document tree, it will be deleted from the document tree and then reinserted in its new position. Nodes from one document (or nodes created by one document) cannot be inserted into another document. In other words, the ownerDocument property of newChild must be the same as the ownerDocument property of the current node.


insertAfter

Insert a new child node after the existing child node

1 2
XmlNode XmlCDATASection.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, Return the new child node

If newChild already exists in the document tree, it will be deleted from the document tree and then reinserted in its new position. Nodes from one document (or nodes created by one document) cannot be inserted into another document. In other words, the ownerDocument property of newChild must be the same as the ownerDocument property of the current node.


appendChild

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

1
XmlNode XmlCDATASection.appendChild(XmlNode newChild);

Call parameters:

  • newChild: XmlNode, Specify the added node

Return result:

  • XmlNode, Return this new child node

If newChild already exists in the document tree, it will be deleted from the document tree and then reinserted in its new position. Nodes from one document (or nodes created by one document) cannot be inserted into another document. In other words, the ownerDocument property of newChild must be the same as the ownerDocument property of the current node.


replaceChild

Replace one child node with another

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

Call parameters:

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

Return result:

  • XmlNode, If the replacement is successful, this method can return the replaced node, if the replacement fails, it returns null

If newChild already exists in the document tree, it will be deleted from the document tree and then reinserted in its new position. Nodes from one document (or nodes created by one document) cannot be inserted into another document. In other words, the ownerDocument property of newChild must be the same as the ownerDocument property of the current node.


removeChild

Remove a node from the list of child nodes

1
XmlNode XmlCDATASection.removeChild(XmlNode oldChild);

Call parameters:

  • oldChild: XmlNode, Specify the node to be deleted

Return result:

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

toString

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

1
String XmlCDATASection.toString();

Return result:

  • String, Returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

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

Call parameters:

  • key: String, unused

Return result:

  • Value, Returns a value containing JSON serializable