The GETNODETYPE function is used to obtain the type number of a DOM node, which helps distinguish between different categories of DOM nodes such as element nodes, attribute nodes, text nodes, and document nodes.
Applicability
This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL-compatible mode.
Note
For V4.4.2, this subprogram is available starting with OceanBase Database V4.4.2 BP3.
Syntax
DBMS_XMLDOM.getNodeType (
n IN DBMS_XMLDOM.DOMNODE);
Parameters
Parameters |
Explanation |
|---|---|
| n | To query theDBMS_XMLDOM.DOMNODEHandle. |
Return value
Node type number, of the NUMBER data type. Common values can be compared with the following DBMS_XMLDOM constants:
Constants |
Valid values |
Note |
|---|---|---|
ELEMENT_NODE |
1 | Element Node |
ATTRIBUTE_NODE |
2 | Attribute node |
TEXT_NODE |
3 | Text Node |
CDATA_SECTION_NODE |
4 | CDATA Node |
ENTITY_REFERENCE_NODE |
5 | Entity Reference Node |
ENTITY_NODE |
6 | Entity Node |
PROCESSING_INSTRUCTION_NODE |
7 | Process Instruction Node |
COMMENT_NODE |
8 | Comment Node |
DOCUMENT_NODE |
9 | Document Node |
DOCUMENT_TYPE_NODE |
10 | Document type node |
DOCUMENT_FRAGMENT_NODE |
11 | Document Fragment Node |
NOTATION_NODE |
12 | marker node |
Usage instructions
The return value semantics are consistent with Oracle DOM node type constants, allowing direct comparison with constants such as DBMS_XMLDOM.ELEMENT_NODE and DBMS_XMLDOM.TEXT_NODE, for branching processing of different node categories.
Examples
DECLARE
n DBMS_XMLDOM.DOMNODE;
node_type NUMBER;
BEGIN
node_type := DBMS_XMLDOM.getNodeType(n);
IF node_type = DBMS_XMLDOM.ELEMENT_NODE THEN
NULL; -- Element node processing
ELSIF node_type = DBMS_XMLDOM.TEXT_NODE THEN
NULL; -- Text node processing
END IF;
END;
/
