A DOMNODE handle represents a single node in the DOM tree, such as an element, text, or comment, and can be used to manipulate and access the XML structure. It is commonly used as a parameter or return value for functions such as GETCHILDNODES, GETNODEVALUE, and ITEM. The handle itself is an opaque type, representing a reference object to the parsed XML document. It is only used for input/output to DOM-related APIs and cannot directly access its internal structure.
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 type is available starting with OceanBase Database V4.4.2 BP2.
Syntax
node DBMS_XMLDOM.DOMNODE;
Parameters
Parameters |
Explanation |
|---|---|
| node | Node handle. |
Return value
Node handle.
Usage instructions
DOMNODE is typically obtained from the ITEM child node list, or by traversing child nodes using GETCHILDNODES.
Related subprograms
Subprogram |
Note |
|---|---|
| GETCHILDNODES | Gets the list of direct child nodes. This method requires passing inDOMNODEThe node handle of the specified type is used as the input parameter. |
| ITEM | Fetch from node listDOMNODE. |
| GETNODEVALUE | Reads the node value. This method requires passing inDOMNODEThe node handle of the specified type is used as the input parameter. |
Examples
This example uses the DBMS_XMLPARSER system package to parse an XML document and obtain a DOMDOCUMENT handle. Then, it uses the DBMS_XMLDOM system package to obtain a DOMNODE handle for the XML document and read the node value:
-- Declare parser and document handle variables
DECLARE
p DBMS_XMLPARSER.PARSER;
doc DBMS_XMLDOM.DOMDOCUMENT;
nl DBMS_XMLDOM.DOMNODELIST;
n DBMS_XMLDOM.DOMNODE;
BEGIN
-- Create a parser instance
p := DBMS_XMLPARSER.NEWPARSER;
-- Parse the XML document in the parser.
DBMS_XMLPARSER.PARSECLOB(p, '<root><a/></root>');
-- Get the DOMDocument handle of an XML document
doc := DBMS_XMLPARSER.GETDOCUMENT(p);
-- Release parser instance
DBMS_XMLPARSER.FREEPARSER(p);
-- Get a list of all elements named "a" in the XML document.
nl := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(doc, 'a');
-- Gets the first element in the list
n := DBMS_XMLDOM.ITEM(nl, 0);
-- Release XML Document Resources
DBMS_XMLDOM.FREEDOCUMENT(doc);
END;
/
