The PARSECLOB procedure parses an input CLOB character sequence into an XML document on a specified parser instance. Upon successful parsing, a DOM tree structure is generated internally within the parser, which can be subsequently obtained using the GETDOCUMENT method.
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.PARSE_CLOB (
parser IN DBMS_XMLPARSER.PARSER,
xml_text IN CLOB);
Parameters
Parameters |
Explanation |
|---|---|
| parser | ByNEWPARSERCreated onDBMS_XMLPARSER.PARSERHandle. |
| xml_text | The XML text to be parsed, inCLOBcan also be implicitly converted toCLOBis a string literal. |
Usage instructions
If the parsing process encounters errors such as invalid XML or an empty document, it will report an error directly. After successful parsing, it is recommended to immediately use GETDOCUMENT to obtain a DBMS_XMLDOM.DOMDOCUMENT handle, and then use the relevant subprograms of DBMS_XMLDOM to traverse the DOM tree and read nodes.
Examples
This example uses the DBMS_XMLPARSER system package to parse an XML document on a parser, passes it in as a CLOB, and finally releases the parser handle:
DECLARE
p DBMS_XMLPARSER.PARSER;
xml CLOB;
BEGIN
-- Create a parser instance
p := DBMS_XMLPARSER.NEWPARSER;
-- Parse the XML document in the parser.
xml := '<root/>';
-- Parse the XML document on the parser and pass it in as a CLOB.
DBMS_XMLPARSER.PARSECLOB(p, xml);
-- Release the parser handle.
DBMS_XMLPARSER.FREEPARSER(p);
END;
/
