MarkLogic 9 Product Documentation
ArrayNode.nodeTypeArrayNode.nodeType as Number
Summary
This is inherited from the Node object.
Return the DOM code indicating the type of the node.
Usage Notes
MarkLogic supports an extended set of node types in addition to the
standard XML DOM node node type values. The
Node
object defines
symbolic constants equivalent to these values, such as Node.DOCUMENT_NODE.
The tables below include both the raw value and constant name for each
node type.
The following are the standard DOM node type values. Each type
is identified by its symbolic constant, followed by the raw value in
parentheses.
- Node.ELEMENT_NODE (1)
- An element node
- Node.ATTRIBUTE_NODE (2)
- An element attribute node
- Node.TEXT_NODE (3)
- A text node
- Node.CDATA_SECTION_NODE (4)
- A CDATA section node
- Node.ENTITY_REFERENCE_NODE (5)
- An entity reference node
- Node.ENTITY_NODE (6)
- An entity node
- Node.PROCESSING_INSTRUCTION_NODE (7)
- An XML processing instruction node
- Node.COMMENT_NODE (8)
- An XML comment node
- Node.DOCUMENT_NODE (9)
- A document node
- Node.DOCUMENT_TYPE_NODE (10)
- An XML document type node
- Node.DOCUMENT_FRAGMENT_NODE (11)
- A document fragment node
- Node.NOTATION_NODE (12)
- A notation node
The following are MarkLogic's extended node type values.
- Node.BINARY_NODE (13)
- A binary node (binary documents)
- Node.NULL_NODE (14)
- A JSON null node
- Node.BOOLEAN_NODE (15)
- A JSON boolean node
- Node.NUMBER_NODE (16)
- A JSON number node
- Node.ARRAY_NODE (17)
- A JSON array node
- Node.OBJECT_NODE (18)
- A JSON object node
Example
function firstChildIsText(node) {
return (node.nodeType == Node.TEXT_NODE);
};
firstChildIsText(
fn.head(cts.doc("example.xml").xpath("./body/node()"));
Copyright © 2024 MarkLogic Corporation. MARKLOGIC is a
registered trademark of MarkLogic Corporation.