After a successful PARSECLOB call, the GETDOCUMENT function can be used to obtain the DBMS_XMLDOM.DOMDOCUMENT handle corresponding to the currently parsed XML from the parser. This handle can then be used to traverse the DOM tree and read nodes using related subprograms of DBMS_XMLDOM.
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 BP2.
Syntax
DBMS_XMLPARSER.getDocument (
parser IN DBMS_XMLPARSER.PARSER);
Parameters
Parameters |
Explanation |
|---|---|
| parser | CompletedPARSECLOBofDBMS_XMLPARSER.PARSERHandle. |
Return value
The DBMS_XMLDOM.DOMDOCUMENT handle corresponding to the current parsed result.
Usage instructions
Document handles and the parser have independent lifecycles. A document handle remains usable even after the parser is released. However, note that document resources must ultimately be explicitly freed using the FREEDOCUMENT statement to avoid memory leaks.
Examples
This example uses the DBMS_XMLPARSER system package to parse an XML document and obtain a DOMDocument handle, and then releases the document resources using the DBMS_XMLDOM system package:
DECLARE
p DBMS_XMLPARSER.PARSER;
doc DBMS_XMLDOM.DOMDOCUMENT;
BEGIN
-- Create a parser instance
p := DBMS_XMLPARSER.NEWPARSER;
-- Parse the XML document in the parser.
DBMS_XMLPARSER.PARSECLOB(p, '<root/>');
-- Get the DOMDocument handle of an XML document
doc := DBMS_XMLPARSER.GETDOCUMENT(p);
-- Release the parser handle.
DBMS_XMLPARSER.FREEPARSER(p);
-- Release XML Document Resources
DBMS_XMLDOM.FREEDOCUMENT(doc);
END;
/
