Oracle9i XML API Reference - XDK and Oracle XML DB Release 2 (9.2) Part Number A96616-01 |
|
The user can access the contents and structure of XML documents through the APIs of the DBMS_XMLPARSER Package.
This chapter discusses the following topics:
The Extensible Markup Language (XML) describes a class of data objects called XML documents. It partially describes the behavior of computer programs which process them. XML is an application profile or restricted form of the Standard Generalized Markup Language (SGML). By construction, XML documents are conforming SGML documents.
XML documents are made up of storage units called entities, which contain either parsed or unparsed data. Parsed data is made up of characters, some of which form character data, and some of which form markup. Markup encodes a description of the document's storage layout and logical structure. XML provides a mechanism to impose constraints on the storage layout and logical structure.
A software module called an XML processor is used to read XML documents and provide access to their content and structure. It is assumed that an XML processor is doing its work on behalf of another module, called the application. This PL/SQL implementation of the XML processor (or parser) followed the W3C XML specification (rev. REC-xml-19980210) and included the required behavior of an XML processor in terms of how it must read XML data and the information it must provide to the application.
The following is the default behavior for this PL/SQL XML parser:
Parses XML stored in the given url/file. An application error is raised if parsing fails. The options are described in the following table.
Parameter | IN / OUT | Description |
---|---|---|
url |
(IN) |
Complete path of the url/file to be parsed. |
p |
(IN) |
Parser instance. |
Returns a new parser instance. This function must be called before the default behavior of Parser can be changed and if other parse methods need to be used.
FUNCTION newParser RETURN Parser;
Parses XML stored in the given buffer. Any changes to the default parser behavior should be effected before calling this procedure. An application error is raised if parsing fails.
PROCEDURE parseBuffer( p Parser, doc VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
doc |
(IN) |
XML document buffer to parse. |
Parses XML stored in the given clob. Any changes to the default parser behavior should be effected before calling this procedure. An application error is raised if parsing fails.
PROCEDURE parseClob( p Parser, doc CLOB);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
doc |
(IN) |
XML document buffer to parse. |
Parses the DTD stored in the given url/file. Any changes to the default parser behavior should be effected before calling this procedure. An application error is raised if parsing fails.
PROCEDURE parseDTD( p Parser, url VARCHAR2, root VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
url |
(IN) |
Complete path of the url/file to be parsed. |
p |
(IN) |
Parser instance. |
Parses the DTD stored in the given buffer. Any changes to the default parser behavior should be effected before calling this procedure. An application error is raised if parsing fails.
PROCEDURE parseDTDBuffer( p Parser, dtd VARCHAR2, root VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
dtd |
(IN) |
DTD buffer to parse. |
root |
(IN) |
Name of the root element. |
Parses the DTD stored in the given clob. Any changes to the default parser behavior should be effected before calling this procedure. An application error is raised if parsing fails.
PROCEDURE parseDTDClob( p Parser, dtd CLOB, root VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
dtd |
(IN) |
DTD Clob to parse. |
root |
(IN) |
Name of the root element. |
Sets base directory used to resolve relative URLs. An application error is raised if parsing fails.
PROCEDURE setBaseDir( p Parser, dir VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
dir |
(IN) |
Directory used as a base directory. |
Turns warnings on or off.
PROCEDURE showWarnings( p Parser, yes BOOLEAN);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
yes |
(IN) |
Mode to set: |
Sets errors to be sent to the specified file
PROCEDURE setErrorLog( p Parser, fileName VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
fileName |
(IN) |
Complete path of the file to use as the error log. |
Sets whitespace preserving mode.
PROCEDURE setPreserveWhitespace( p Parser, yes BOOLEAN);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
yes |
(IN) |
Mode to set: |
Sets validation mode.
PROCEDURE setValidationMode( p Parser, yes BOOLEAN);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
yes |
(IN) |
Mode to set: |
Retrieves validation mode; TRUE for validating, FALSE otherwise.
FUNCTION getValidationMode( p Parser) RETURN BOOLEAN;
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
Sets a DTD to be used by the parser for validation. This call should be made before the document is parsed.
PROCEDURE setDoctype( p Parser, dtd DOMDocumentType);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
dtd |
(IN) |
DTD to set. |
Returns the parsed DTD; this function MUST be called only after a DTD is parsed.
FUNCTION getDoctype( p Parser) RETURN DOMDocumentType;
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
Returns the root of the DOM tree document built by the parser; this function MUST be called only after a document is parsed.
FUNCTION getDocument( p Parser) RETURN DOMDocument;
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
Frees a parser object.
PROCEDURE freeParser( p Parser);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Parser instance. |
Returns the release version of the Oracle XML parser for PL/SQL.
PROCEDURE getReleaseVersion RETURN VARCHAR2;
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|