| Oracle9i XML API Reference - XDK and Oracle XML DB Release 2 (9.2) Part Number A96616-01 |
|
XML parsing facilitates the extension of existing applications to support XML by processing XML documents and providing access to the information contained in them through a variety of APIs. This chapter contains the following sections
This class implements the default behavior for the XMLDocumentHandler interface. Application writers can extend this class when they need to implement only part of the interface.
public class DefaultXMLDocumentHandler implements
oracle.xml.parser.v2.XMLDocumentHandler
oracle.xml.parser.v2.DefaultXMLDocumentHandler
XMLDocumentHandler
Constructs a default document.
public DefaultXMLDocumentHandler();
Receive notification of a CDATA Section. The Parser will invoke this method once for each CDATA Section found. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void cDATASection( char[] ch, int start, int length);
| Parameter | Description |
|---|---|
|
ch |
The CDATA section characters. |
|
start |
The start position in the character array. |
|
length |
The number of characters to use from the character array. |
Receives notification of a comment. The Parser will invoke this method once for each comment found: note that comment may occur before or after the main document element. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void comment( String data);
| Parameter | Description |
|---|---|
|
data |
The comment data, or |
Receives notification of end of the DTD. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void endDoctype();
Receives notification of the end of an element. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception. The options are described in the following table.
End the scope of a prefix-URI mapping. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void endPrefixMapping( String prefix);
Returns the next pipe-line node handler node.
public XMLDocumentHandler getHandler();
Sets the DTD so can subsequently receive notification of that DTD. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setDoctype( DTD dtd);
| Parameter | Description |
|---|---|
|
dtd |
The DTD. |
Receives notification of a XMLError handler. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setError( XMLError he);
| Parameter | Description |
|---|---|
|
err |
The XMLError object. |
Receive notification of a next pipe-line node handler. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setHandler( XMLDocumentHandler h);
| Parameter | Description |
|---|---|
|
h |
The XMLDocumentHandler node. |
Receive notification of a Text XML Declaration. The Parser will invoke this method once for each text XML Decl. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setTextDecl( String version, String encoding);
| Parameter | Description |
|---|---|
|
version |
The version number. |
|
encoding |
The encoding name, or NULL if not specified. |
Receive notification of an XML Declaration. The Parser will invoke this method once for XML Decl. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setXMLDecl( String version, String standalone, String encoding);
| Parameter | Description |
|---|---|
|
version |
The version number. |
|
standalone |
The Standalone value, or |
|
encoding |
The encoding name, or |
Receive notification of a XMLSchema object. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setXMLSchema( Object s);
| Parameter | Description |
|---|---|
|
s |
The XMLSchema object. |
Receives notification of a skipped entity. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void skippedEntity( String name);
| Parameter | Description |
|---|---|
|
name |
The name of the skipped entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be the string "[dtd]". |
Receives notification of the beginning of an element. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception. The options are described in the following table.
Begin the scope of a prefix-URI Namespace mapping. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void startPrefixMapping( String prefix, String uri);
| Parameter | Description |
|---|---|
|
prefix |
The Namespace prefix being declared. |
|
uri |
The Namespace URI the prefix is mapped to. |
public class DocumentBuilder oracle.xml.parser.v2.DocumentBuilder
This class implements XMLDocumentHandler (deprecated) and ContentHandler to build a DOM Tree from SAX 2.0 events. XMLDocumentHandler events are supported for backward compatibility
Default constructor. Creates a document builder that can be used as XMLDocumentHandler.
public DocumentBuilder();
Reports an attribute type declaration. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void attributeDecl( String eName, String aName, String type, String valueDefault, String value);
Receives notification of CDATA Section data inside an element. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void cDATASection( char[] ch, int start, int length);
| Parameter | Description |
|---|---|
|
ch |
The CDATA characters. |
|
start |
The starting position in the array. |
|
length |
The number of characters to use from the array. |
Receive notification of character data inside an element. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void characters( char[] ch, int start, int length)
| Parameter | Description |
|---|---|
|
ch |
An array holding the character data. |
|
start |
The starting position in the array. |
|
length |
The number of characters to use from the array. |
Receives notification of a comment. Reports an XML comment anywhere in the document. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception. The options are described in the following table.
| Syntax | Description |
|---|---|
|
int length); |
Receives notification of a comment using the parameters of the comment character array. |
|
String data); |
Receives notification of a comment using the comment data. |
Report an element type declaration. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void elementDecl( String name, String model);
| Parameter | Description |
|---|---|
|
name |
The element type name. |
|
model |
The content model as a normalized string. |
Reports the end of a CDATA section. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void endCDATA();
Receives notification of end of the DTD. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void endDoctype();
Receives notification of the end of the document. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void endDocument();
Reports the end of DTD declarations. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void endDTD();
Receives notification of the end of an element. Throws
org.xml.sax.SAXException, which could be any SAX exception, possibly
wrapping another exception. The options are described in the following table.
Reports the end of an entity. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void endEntity( String name);
| Parameter | Description |
|---|---|
|
name |
The name of the entity that is ending. |
Reports a parsed external entity declaration. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void externalEntityDecl( String name, String publicId, String systemId);
Returns the current XMLNode being build.
public XMLNode getCurrentNode();
Returns the document being build.
public XMLDocument getDocument();
Receives notification of ignorable whitespace in element content. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void ignorableWhitespace( char[] ch, int start, int length);
| Parameter | Description |
|---|---|
|
ch |
The whitespace characters. |
|
start |
The start position in the character array. |
|
length |
The number of characters to use from the character array. |
Report an internal entity declaration. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void internalEntityDecl( String name, String value);
| Parameter | Description |
|---|---|
|
name |
The name of the entity. If it is a parameter entity, the name will begin with '%'. |
|
value |
The replacement text of the entity. |
Receives notification of a processing instruction. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void processingInstruction( String target, String data);
| Parameter | Description |
|---|---|
|
target |
The processing instruction target. |
|
data |
The processing instruction data, or |
Sets a flag to retain CDATA sections
public void retainCDATASection( boolean flag);
| Parameter | Description |
|---|---|
|
flag |
Determines whether CDATA sections are retained; |
Sets a flag to turn on debug information in the document.
public void setDebugMode(b oolean flag);
| Parameter | Description |
|---|---|
|
flag |
Determines whether debug info is stored; |
Sets the DTD so can subsequently receive notification of that DTD. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setDoctype( DTD dtd);
| Parameter | Description |
|---|---|
|
did |
The DTD for the document. |
Sets the Locator so can subsequently receive notification for this Locator object for document events. By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.
public void setDocumentLocator( org.xml.sax.Locator locator);
| Parameter | Description |
|---|---|
|
locator |
A locator for all SAX document events. |
Sets a optional NodeFactory to be used for creating custom DOM trees.
public void setNodeFactory( NodeFactory f);
| Parameter | Description |
|---|---|
|
f |
NodeFactory/ |
Receive notification of a Text XML Declaration. The Parser will invoke this method once for each text XML Decl. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setTextDecl( String version, String encoding);
| Parameter | Description |
|---|---|
|
version |
The version number, or |
|
encoding |
The encoding name, or |
Receive notification of a XML Declaration. The Parser will invoke this method once for XML Decl. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void setXMLDecl( String version, String standalone, String encoding);
| Parameter | Description |
|---|---|
|
version |
The version number. |
|
standalone |
The standalone value, or |
|
encoding |
The encoding name, or |
Reports the start of a CDATA section. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void startCDATA();
Receive notification of the beginning of the document. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void startDocument();
Report the start of DTD declarations, if any. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void startDTD( String name, String publicId, String systemId);
Receives notification of the beginning of an element. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception. The options are described in the following table.
Reports the beginning of some internal and external XML entities. All start/endEntity events must be properly nested. Throws org.xml.sax.SAXException, which could be any SAX exception, possibly wrapping another exception.
public void startEntity( String name);
| Parameter | Description |
|---|---|
|
name |
The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be "[dtd]". |
public class DOMParser oracle.xml.parser.v2.DOMParser
This class implements an eXtensible Markup Language (XML) 1.0 parser according to the World Wide Web Consortium (W3C) recommendation. to parse a XML document and build a DOM tree.
Creates a new parser object.
public DOMParser();
Returns specific attributes on the underlying implementation. Throws IllegalArgumentException if the underlying implementation doesn't recognize the attribute.
public java.lang.Object getAttribute( String name);
| Parameter | Description |
|---|---|
|
name |
The name of the attribute. |
Returns the DTD.
public DTD getDoctype();
Returns the document being parsed.
public XMLDocument getDocument();
Parses the XML External DTD from given input stream. Throws the following exceptions:
XMLParseException if syntax or other error encountered.SAXException, which could be SAX exception, possibly wrapping another exception.IOException in cases of I/O Error.The options are described in the following table.