The PARSEBUFFER procedure can parse XML text in VARCHAR2 format on an existing XML parser. Similar to PARSECLOB, it is suitable for shorter XML texts. After successful parsing, you can use GETDOCUMENT to obtain the DOM document.
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 subprogram is available starting with OceanBase Database V4.4.2 BP3.
Syntax
DBMS_XMLPARSER.parseBuffer (
parser IN DBMS_XMLPARSER.PARSER,
xml_buffer IN VARCHAR2);
Parameters
Parameters |
Explanation |
|---|---|
| parser | byNEWPARSERCreated onDBMS_XMLPARSER.PARSERHandle. |
| xml_buffer | The XML text to be parsed, in the format ofVARCHAR2passed in the form. |
Return value
No return value.
Usage instructions
- If the parsing process encounters exceptions such as invalid XML or an empty document, it will report an error directly.
- After successful parsing, it is recommended to immediately use
GETDOCUMENTto obtain theDBMS_XMLDOM.DOMDOCUMENThandle. - For longer XML texts, continue to use PARSECLOB.
Examples
This example parses short-text XML using PARSEBUFFER, obtains the DOM document, and then releases resources:
DECLARE
parser DBMS_XMLPARSER.PARSER;
doc DBMS_XMLDOM.DOMDOCUMENT;
BEGIN
parser := DBMS_XMLPARSER.newParser;
DBMS_XMLPARSER.parseBuffer(parser, '<root><item>hello</item></root>');
doc := DBMS_XMLPARSER.getDocument(parser);
DBMS_XMLPARSER.freeParser(parser);
DBMS_XMLDOM.freeDocument(doc);
END;
/
