The DBMS_XMLPARSER system package is used to parse XML text from a CLOB or VARCHAR2 and build a DOM parse tree that can be accessed by DBMS_XMLDOM.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL-compatible mode.
Note
For V4.4.2, this system package is available starting with OceanBase Database V4.4.2 BP2.
DBMS_XMLPARSER Privileges
The EXECUTE privilege on the DBMS_XMLPARSER system package is granted to PUBLIC. The current user has the privilege to use the subprograms within this package.
Usage instructions for DBMS_XMLPARSER
The DBMS_XMLPARSER reads XML from a CLOB or VARCHAR2 and parses it into a DOM tree. After successful parsing, you can use GETDOCUMENT to obtain a DOMDocument handle, and then use subprograms in DBMS_XMLDOM to traverse nodes, read elements, and node values. If parsing fails, an application error is thrown.
The typical process is as follows:
- Call
NEWPARSERto create a parser (Parserhandle). - Call
PARSECLOBto parse the XML text in aCLOB, or callPARSEBUFFERto parse the short-text XML in aVARCHAR2. - Call
GETDOCUMENTto obtain theDBMS_XMLDOM.DOMDOCUMENThandle. - Use the DBMS_XMLDOM subprograms to access the parsed results.
Note
The current version parses XML in CLOB using PARSECLOB and parses short-text XML in VARCHAR2 using PARSEBUFFER (supported since V4.4.2 BP3), constructing a parse tree accessible via the DOM interface. Capabilities such as parsing from file paths or URLs, DTD validation, and error logging are not currently supported.
For information about creating and converting XMLType objects, see XMLType overview.
Overview of DBMS_XMLPARSER Subprograms
The following table describes the DBMS_XMLPARSER subprograms supported by the current version of OceanBase Database and provides brief descriptions.
Subprogram |
Description |
|---|---|
| PARSER | Parser Handle |
| NEWPARSER | Create a parser. |
| PARSECLOB | ParsingCLOBXML in |
| PARSEBUFFER | ParsingVARCHAR2the XML in it |
| GETDOCUMENT | TakeDBMS_XMLDOM.DOMDOCUMENThandle |
| FREEPARSER | Releases the parser. |
