- ATTRIBUTE_NODE
- CDATA_SECTION_NODE
- COMMENT_NODE
- DOCUMENT_FRAGMENT_NODE
- DOCUMENT_NODE
- DOCUMENT_TYPE_NODE
- ELEMENT_NODE
- ENTITY_NODE
- ENTITY_REFERENCE_NODE
- NOTATION_NODE
- PROCESSING_INSTRUCTION_NODE
- TEXT_NODE
A class describing an CDataNode.
newCDataNode(value?: string): CDataNode;Constructs a new CDataNode instance.
| Parameter | Type | Default value | Description |
|---|---|---|---|
value? | string | '' | The data for the node |
CDataNode
| Property | Type | Default value | Description | Inherited from |
|---|---|---|---|---|
childNodes | Node[] | [] | The node's immediate children. | Node.childNodes |
nodeName | string | '#node' | A node type string identifier. | Node.nodeName |
nodeType | number | 0 | A numerical node type identifier. | Node.nodeType |
parentNode | Node | null | null | The node's parent node. | Node.parentNode |
value | string | undefined | The nodes data value. | - |
getpreserveSpace(): boolean;True if xml:space has been set to true for this node or any of its ancestors.
boolean
gettextContent(): string;The text content of this node (and its children).
string
appendChild(node: Node): Node;Appends a child node into the current one.
| Parameter | Type | Description |
|---|---|---|
node | Node | The new child node |
The same node that was passed in.
toString(): string;Returns a string representation of the node.
string
A formatted XML source.
This class describes an XML document.
newDocument(): Document;Constructs a new Document instance.
Document
| Property | Type | Default value | Description | Inherited from |
|---|---|---|---|---|
childNodes | Node[] | [] | The node's immediate children. | Node.childNodes |
nodeName | string | '#node' | A node type string identifier. | Node.nodeName |
nodeType | number | 0 | A numerical node type identifier. | Node.nodeType |
parentNode | Node | null | null | The node's parent node. | Node.parentNode |
root | Element | null | null | - | - |
getchildren(): Element[];A list containing all child Elements of the current Element.
Element[]
getpreserveSpace(): boolean;True if xml:space has been set to true for this node or any of its ancestors.
boolean
gettextContent(): string;The text content of this node (and its children).
string
appendChild(node: Element): Element;Appends a child node into the current one.
| Parameter | Type | Description |
|---|---|---|
node | Element | The new child node |
The same node that was passed in.
getElementsByTagName(tagName: string): Element[];Return all descendant elements that have the specified tag name.
| Parameter | Type | Description |
|---|---|---|
tagName | string | The tag name to filter by. |
Element[]
The elements by tag name.
querySelector(selector: string): Element|null;Return the first descendant element that match a specified CSS selector.
| Parameter | Type | Description |
|---|---|---|
selector | string | The CSS selector to filter by. |
Element | null
The elements by tag name.
querySelectorAll(selector: string): Element[];Return all descendant elements that match a specified CSS selector.
| Parameter | Type | Description |
|---|---|---|
selector | string | The CSS selector to filter by. |
Element[]
The elements by tag name.
toJS(): []|JsonMLElement;Returns a simple object representation of the node and its descendants.
[] | JsonMLElement
JsonML representation of the nodes and its subtree.
toString(): string;Returns a string representation of the node.
string
A formatted XML source.
A class describing an Element.
newElement(tagName: string,attr?: Record<string,string>,closed?: boolean): Element;Constructs a new Element instance.
| Parameter | Type | Default value | Description |
|---|---|---|---|
tagName | string | undefined | The tag name of the node. |
attr? | Record<string, string> | {} | A collection of attributes to assign. |
closed? | boolean | false | Was the element "self-closed" when read. |
Element
| Property | Type | Default value | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
attr | Record<string, string> | undefined | An object of attributes assigned to this element. | - | - |
childNodes | Node[] | [] | The node's immediate children. | - | Node.childNodes |
closed | boolean | undefined | A state representing if the element was "self-closed" when read. | - | - |
fullName | string | undefined | The full name of the tag for the given element, including a namespace prefix. | - | - |
nodeName | string | '#node' | A node type string identifier. | - | Node.nodeName |
nodeType | number | 0 | A numerical node type identifier. | - | Node.nodeType |
ns | string | undefined | The namespace prefix of the element, or null if no prefix is specified. | - | - |
parentNode | Element | null | null | The node's parent node. | Node.parentNode | - |
tagName | string | undefined | The name of the tag for the given element, excluding any namespace prefix. | - | - |
getchildren(): Element[];A list containing all child Elements of the current Element.
Element[]
getpreserveSpace(): boolean;True if xml:space has been set to true for this node or any of its ancestors.
boolean
gettextContent(): string;The text content of this node (and its children).
string
appendChild(node: Node): Node;Appends a child node into the current one.
| Parameter | Type | Description |
|---|---|---|
node | Node | The new child node |
The same node that was passed in.
getAttribute(name: string): string |null;Read an attribute from the element.
| Parameter | Type | Description |
|---|---|---|
name | string | The attribute name to read. |
string | null
The attribute.
getElementsByTagName(tagName: string): Element[];Return all descendant elements that have the specified tag name.
| Parameter | Type | Description |
|---|---|---|
tagName | string | The tag name to filter by. |
Element[]
The elements by tag name.
hasAttribute(name: string): boolean;Test if an attribute exists on the element.
| Parameter | Type | Description |
|---|---|---|
name | string | The attribute name to test for. |
boolean
True if the attribute is present.
querySelector(selector: string): Element|null;Return the first descendant element that match a specified CSS selector.
| Parameter | Type | Description |
|---|---|---|
selector | string | The CSS selector to filter by. |
Element | null
The elements by tag name.
querySelectorAll(selector: string): Element[];Return all descendant elements that match a specified CSS selector.
| Parameter | Type | Description |
|---|---|---|
selector | string | The CSS selector to filter by. |
Element[]
The elements by tag name.
removeAttribute(name: string): void;Remove an attribute off the element.
| Parameter | Type | Description |
|---|---|---|
name | string | The attribute name to remove. |
void
setAttribute(name: string,value: string): void;Sets an attribute on the element.
| Parameter | Type | Description |
|---|---|---|
name | string | The attribute name to read. |
value | string | The value to set |
void
toJS(): JsonMLElement;Returns a simple object representation of the node and its descendants.
JsonML representation of the nodes and its subtree.
toString(): string;Returns a string representation of the node.
string
A formatted XML source.
A class describing a Node.
newNode(): Node;Node
getpreserveSpace(): boolean;True if xml:space has been set to true for this node or any of its ancestors.
boolean
gettextContent(): string;The text content of this node (and its children).
string
appendChild(node: Node): Node;Appends a child node into the current one.
| Parameter | Type | Description |
|---|---|---|
node | Node | The new child node |
Node
The same node that was passed in.
toString(): string;Returns a string representation of the node.
string
A formatted XML source.
A class describing a TextNode.
newTextNode(value?: string): TextNode;Constructs a new TextNode instance.
| Parameter | Type | Description |
|---|---|---|
value? | string | The data for the node |
TextNode
| Property | Type | Default value | Description | Inherited from |
|---|---|---|---|---|
childNodes | Node[] | [] | The node's immediate children. | Node.childNodes |
nodeName | string | '#node' | A node type string identifier. | Node.nodeName |
nodeType | number | 0 | A numerical node type identifier. | Node.nodeType |
parentNode | Node | null | null | The node's parent node. | Node.parentNode |
value | string | undefined | The node's data value. | - |
getpreserveSpace(): boolean;True if xml:space has been set to true for this node or any of its ancestors.
boolean
gettextContent(): string;The text content of this node (and its children).
string
appendChild(node: Node): Node;Appends a child node into the current one.
| Parameter | Type | Description |
|---|---|---|
node | Node | The new child node |
The same node that was passed in.
toString(): string;Returns a string representation of the node.
string
A formatted XML source.
functionparseXML(source: string,options?: {emptyDoc?: boolean;laxAttr?: boolean;}): Document;Parse an XML source and return a Node tree.
| Parameter | Type | Default value | Description |
|---|---|---|---|
source | string | undefined | The XML source to parse. |
options? | { emptyDoc?: boolean; laxAttr?: boolean; } | DEFAULTOPTIONS | Parsing options. |
options.emptyDoc? | boolean | undefined | Permit "rootless" documents. |
options.laxAttr? | boolean | undefined | Permit unquoted attributes (<node foo=bar />). |
A DOM representing the XML node tree.
typeJsonMLAttr=Record<string,string|number|boolean|null>;typeJsonMLElement=|[string,JsonMLAttr, ...JsonMLElement[]]|[string,JsonMLAttr]|[string, ...JsonMLElement[]]|[string]|string;constATTRIBUTE_NODE: number=2;An attribute node identifier
constCDATA_SECTION_NODE: number=4;A CData Section node identifier
constCOMMENT_NODE: number=8;A comment node identifier
constDOCUMENT_FRAGMENT_NODE: number=11;A document fragment node identifier
constDOCUMENT_NODE: number=9;A document node identifier
constDOCUMENT_TYPE_NODE: number=10;A document type node identifier
constELEMENT_NODE: number=1;An element node identifier
constENTITY_NODE: number=6;An entity node identifier
constENTITY_REFERENCE_NODE: number=5;An entity reference node identifier
constNOTATION_NODE: number=12;A documentation node identifier
constPROCESSING_INSTRUCTION_NODE: number=7;A processing instruction node identifier
constTEXT_NODE: number=3;A text node identifier