The DBMS_XMLDOM system package is used to access XMLType objects and implement the Document Object Model (DOM), an Application Programming Interface (API) for HTML and XML documents. The DOM defines the logical structure of a document, as well as the ways in which the document can be accessed and manipulated.
In the DOM specification, the term "document" is used in a broad sense: XML can represent a wide variety of information stored in different systems. This information is traditionally considered data, but it is still presented in a document format.
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 system package is available starting with OceanBase Database V4.4.2 BP2.
DBMS_XMLDOM Privileges
The EXECUTE privilege on the DBMS_XMLDOM system package is granted to PUBLIC. The current user has the privilege to use the subprograms within this package.
Considerations
After obtaining a DBMS_XMLDOM.DOMDOCUMENT handle through DBMS_XMLPARSER, you can use the subprograms in this package to traverse the DOM tree and read element and node values. For the complete parsing and release process, see Usage notes for DBMS_XMLPARSER.
The typical processing flow is as follows:
- Parse XML using DBMS_XMLPARSER or create an empty document using
NEWDOMDOCUMENTto obtain theDBMS_XMLDOM.DOMDOCUMENThandle. - Use
GETELEMENTSBYTAGNAME,ITEM,GETLENGTH,GETFIRSTCHILD, and other subprograms to traverse nodes; or useCREATEELEMENT,CREATETEXTNODE,APPENDCHILD,SETATTRIBUTE, and other subprograms to construct and modify the DOM tree. - Use
GETNODEVALUE,GETDATA,GETNODENAME, and other subprograms to read node information; output data usingGETXMLTYPE,WRITETOBUFFER,WRITETOCLOB, and other subprograms when necessary. - Call
FREEDOCUMENTto release document resources.
For information about the DBMS_XMLDOM subprograms supported by the current version of OceanBase Database, see Overview of DBMS_XMLDOM Subprograms below.
For information about creating and converting XMLType objects, see XMLType overview.
Overview of DBMS_XMLDOM Subprograms
The following table describes the DBMS_XMLDOM subprograms supported by the current version of OceanBase Database and provides brief descriptions.
Subprogram |
Description |
|---|---|
| DOMDOCUMENT | Identifies the XML document. |
| DOMNODE | Identifies a DOM node. |
| DOMNODELIST | Identifies a node list |
| DOMATTR | Identifies a DOM attribute node (Supported in V4.4.2 BP3 and later). |
| DOMELEMENT | Identifies a DOM element node (Supported in V4.4.2 BP3 and later). |
| DOMTEXT | Identifies a DOM text node (Supported in V4.4.2 BP3 and later). |
| DOMCHARACTERDATA | Identifies a DOM character data node (Supported in V4.4.2 BP3 and later). |
| FREEDOCUMENT | Releases the DOM document |
| GETCHILDNODES | Obtains the list of child nodes |
| GETELEMENTSBYTAGNAME | Obtains elements by tag name (name='*' matches any element) |
| GETLENGTH | Obtains the number of nodes |
| GETNODEVALUE | Obtains the node value |
| ITEM | Obtains a node by index |
| NEWDOMDOCUMENT | Creates a new empty DOM document (Supported in V4.4.2 BP3 and later). |
| CREATEELEMENT | Creates an element node (Supported in V4.4.2 BP3 and later). |
| CREATETEXTNODE | Creates a text node (Supported in V4.4.2 BP3 and later). |
| MAKENODE | Converts a specific DOM object into a generic node (Supported in V4.4.2 BP3 and later). |
| MAKECHARACTERDATA | Converts a node into a character data handle (Supported in V4.4.2 BP3 and later). |
| APPENDCHILD | Appends a child node (Supported in V4.4.2 BP3 and later). |
| REMOVECHILD | Removes a child node (Supported in V4.4.2 BP3 and later). |
| GETFIRSTCHILD | Obtains the first child node (Supported in V4.4.2 BP3 and later). |
| GETDOCUMENTELEMENT | Obtains the root element of the document (Supported in V4.4.2 BP3 and later). |
| GETNODENAME | Obtains the node name (Supported in V4.4.2 BP3 and later). |
| GETLOCALNAME | Obtains the local name of the node (Supported in V4.4.2 BP3 and later). |
| GETNODETYPE | Obtains the node type (Supported in V4.4.2 BP3 and later). |
| GETDATA | Obtains the character data content (Supported in V4.4.2 BP3 and later). |
| ISNULL | Checks whether a DOM handle is null (Supported in V4.4.2 BP3 and later). |
| SETATTRIBUTE | Sets an element attribute (Supported in V4.4.2 BP3 and later). |
| SETCHARSET | Sets the document character set (Supported in V4.4.2 BP3 and later). |
| SETVERSION | Sets the document XML version (Supported in V4.4.2 BP3 and later). |
| WRITETOBUFFER | Writes a document or node to a VARCHAR2 buffer (Supported in V4.4.2 BP3 and later). |
| WRITETOCLOB | Writes a document or node to a CLOB (Supported in V4.4.2 BP3 and later). |
| GETXMLTYPE | Converts a DOM document to XMLTYPE (Supported in V4.4.2 BP3 and later). |