Oracle9i XML API Reference - XDK and Oracle XML DB Release 2 (9.2) Part Number A96616-01 |
|
Because XML files typically have repeated tags, compression of a streaming of XML structure and tokenizing of the XML tags can be very effective. Since it parses documents in real time, without waiting for the complete document to be read first, compression and decompression yield high performance benefits when exchanging a document over the internet between two sub-systems. XML compression retains the structural and hierarchical information of the XML data in the compressed format.
This chapter describes the oracle.xml.parser.v2
package classes responsible for compression:
The SAX compression is implemented using SAX Handler, which compresses the data based on SAX events. To use the SAX compression, the application needs to implement this interface and register with the SAX parser through the Parser.setDocumentHandler().
public class CXMLHandlerBase implements oracle.xml.parser.v2.XMLDocumentHandler oracle.xml.comp.CXMLHandlerBase
oracle.xml.parser.v2.XMLDocumentHandler
Creates a new CXMLHandlerBase. The options are described in the following table.
Parameter | Description |
---|---|
out |
The output stream. |
Receives notification of a CDATA Section. The Parser will invoke this method once for each CDATA Section found. Throws org.xml.sax.SAXException
, which can be any SAX exception, possibly wrapping another exception.
public void cDATASection( char[] cbuf, int start, int len);
Parameter | Description |
---|---|
cbuf |
The CDATA section characters. |
start |
The start position in the character array. |
len |
The number of characters to use from the character array. |
Receives notification of character data inside an element.
public void characters( char[] cbuf, int start, int len);
Parameter | Description |
---|---|
cbuf |
Characters |
start |
The starting position in the character array. |
len |
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 can be any SAX exception, possibly wrapping another exception.
public void comment( String text);
Parameter | Description |
---|---|
text |
The comment data; |
Receives notification of end of the DTD. Throws org.xml.sax.SAXException
, which can 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 can be any SAX exception, possibly wrapping another exception.
public void endDocument();
Receives notification of the end of the element.
public void endElement( oracle.xml.parser.v2.NSName elem);
Parameter | Description |
---|---|
elem |
The element. |
Receives notification of the end of scope of prefix URI mapping.
public void endPrefixMapping( String prefix);
Parameter | Description |
---|---|
prefix |
The prefix that was being mapped. |
Returns the CXML Context used for compression.
public oracle.xml.comp.CXMLContext getCXMLContext();
Looks up and returns the value of a property. The property name is any fully-qualified URI.
public java.lang.Object getProperty( String name);
Parameter | Description |
---|---|
name |
The property name, which is a fully-qualified URI. |
Receives notification of ignorable whitespace in element content.
public void ignorableWhitespace( char[] cbuf, int start, int len);
Parameter | Description |
---|---|
cbuf |
The Character from XML document. |
start |
The start position in the array. |
len |
The number of characters to read from the array. |
Receives notification of a processing instruction.
public void processingInstruction( String target, String data);
Parameter | Description |
---|---|
target |
The processing instruction target. |
data |
The processing instruction data. |
Registers DTD so can subsequently receive notification on that DTD. The Parser will invoke this method after calling startDocument()
to register the DTD used. Throws org.xml.sax.SAXException
, which can be any SAX exception, possibly wrapping another exception.
public void setDoctype( oracle.xml.parser.v2.DTD dtd);
Parameter | Description |
---|---|
dtd |
The DTD node. |
Registers Locator object so can subsequently receive notification for that Locator object for the document event. By default, do nothing. This method could be overridden by the subclasses events.
public void setDocumentLocator( org.xml.sax.Locator locator);
Parameter | Description |
---|---|
locator |
The locator for the SAX document events. |
Registers XMLError handler so can subsequently receive notification of that XMLError handler. Throws org.xml.sax.SAXException
, which can be any SAX exception, possibly wrapping another exception.
public void setError( oracle.xml.parser.v2.XMLError he);
Parameter | Description |
---|---|
he |
The XMLError object. |
Sets the value of a property. The property name is any fully-qualified URI.
public void setProperty( String name, Object value);
Parameter | Description |
---|---|
name |
The property name, which is a fully-qualified URI. |
value |
The requested value for the property. |
Registers Text XML Declaration so can subsequently receive notification of that Text XML Declaration. The Parser will invoke this method once for each text XMLDecl
. Throws org.xml.sax.SAXException
, which can 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. |
Registers XML Declaration so can subsequently receive notification of that XML Declaration. The Parser will invoke this method once for XMLDecl
. Throws org.xml.sax.SAXException
, which can 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; |
encoding |
The encoding name; |
Registers XMLSchema so can subsequently receive notification of that XMLSchema object. Throws org.xml.sax.SAXException
, which can be any SAX exception, possibly wrapping another exception.
public void setXMLSchema( Object s);
Parameter | Description |
---|---|
s |
The XMLSchema object. |
public void skippedEntity( String name);
Receives notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the external-general-entities
and the external-parameter-entities
properties. Throws org.xml.sax.SAXException
, which can be any SAX exception, possibly wrapping another exception.
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 the document. By default, do nothing. This method could be overridden by the subclasses to take specific actions at the beginning of a document.
public void startDocument();
Receives notification of the beginning of an element.
public void startElement( oracle.xml.parser.v2.NSName elem, oracle.xml.parser.v2.SAXAttrList attributes);
Parameter | Description |
---|---|
elem |
The element. |
attributes |
Attributes of the element. |
Receives notification of the beginning of the scope of prefix URI mapping.
public void startPrefixMapping( String prefix, String uri);
Parameter | Description |
---|---|
prefix |
The Namespace prefix being declared. |
uri |
The Namespace URI to which the prefix is mapped. |
This class implements the re-generation of XML document from the compressed stream by generating the SAX events from them.
public class CXMLParser oracle.xml.comp.CXMLParser
Creates a new XML Parser object for reading the compressed stream.
public CXMLParser();
Retrieves content handler; returns NULL
if the handler has not been registered.
public org.xml.sax.ContentHandler getContentHandler();
Retrieves the current error handler; returns NULL
if the handler has not been registered.
public org.xml.sax.ErrorHandler getErrorHandler();
Parses the compressed stream and generates the SAX events. Throws the following exceptions:
public void parse( String inFile);
Parameter | Description |
---|---|
inFile |
The input source which needs to be parsed to regenerate the SAX events. |
Registers a content event handler.
public void setContentHandler( org.xml.sax.ContentHandler handler);
Parameter | Description |
---|---|
handler |
The content handler |
Registers an error event handler.
public void setErrorHandler( org.xml.sax.ErrorHandler handler);
Parameter | Description |
---|---|
handler |
The error handler |
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|