| Oracle9i Supplied Java Packages Reference Release 2 (9.2) Part Number A96609-01 |
|
This chapter describes the classes contained in package oracle.xml.parser.v2. These classes implement the XML Parser, the DOM, and the SAX APIs in the Oracle XDK for Java. (DOM is for Document Object Model, and SAX is for Simple API for XML.) The full functionality of XML Parser, DOM, and SAX APIs are contained in the oracle.xml.parser.v2 package.
This chapter contains these sections:
|
Note: The supporting utility classes are found in package oracle.xml.util, which is documented in Chapter 10, "Package oracle.xml.util" in this manual. |
The classes contained in package oracle.xml.parser.v2 implement the APIs for the XML Parser, DOM, and SAX in the Oracle9i XDK for Java. The classes that implement the XSLT Processor for Java are also contained in the oracle.xml.parser.v2 package.
The Oracle implementations of the DOM and SAX APIs adhere to the World Wide Web Consortium (W3C) recommendations for the XML standard.
The supporting utility classes are found in package oracle.xml.util, which is documented in Chapter 10, "Package oracle.xml.util"in this manual.
The tables in this section summarize the oracle.xml.parser.v2 interfaces and classes documented in this chapter.
| Interface | Description |
|---|---|
|
Provides support for resolving Namespaces. |
|
|
The |
|
|
Basic interface for XMLToken. |
| Exception | Description |
|---|---|
|
Indicates an exception in DOM operation. |
|
|
Indicates that a parsing exception occurred while processing an XML document |
|
|
Indicates an exception in DOM Range operation. |
The classes listed in Table 11-4, " Summary of XSLT Processor Classes in package oracle.xml.parserv2" summarize the XSLT Processor classes contained in the oracle.xml.parser.v2 package.
public interface NSResolver
This interface provides support for resolving Namespaces
XMLElement
Find the namespace definition in scope for a given namespace prefix
public java.lang.String resolveNamespacePrefix(java.lang.String prefix)
prefix - Namespace prefix to be resolved
the resolved Namespace (null, if prefix could not be resolved)
The PrintDriver interface defines methods used to print XML documents represented as DOM trees.
public interface PrintDriver
XMLPrintDriver
Closes the output stream or print writer
public void close()
Flushes the output stream or print writer
public void flush()
Prints a XMLAttr node
public void printAttribute(XMLAttr attr)
attr - The XMLAttr node.
Calls print method for each attribute of the XMLElement
public void printAttributeNodes(XMLElement elem)
elem - The elem whose attributes are to be printed.
Prints a XMLCDATA node
public void printCDATASection(XMLCDATA cdata)
cdata - The XMLCDATA node.
Calls print method for each child of the XMLNode
public void printChildNodes(XMLNode node)
node - The node whose children are to be printed.
Prints a XMLComment node
public void printComment(XMLComment comment)
comment - The comment node.
Prints an DTD.
public void printDoctype(DTD dtd)
dtd - The dtd to be printed.
Prints an XMLDocument.
public void printDocument(XMLDocument doc)
elem - The document to be printed.
public void printDocumentFragment(XMLDocumentFragment dfrag)
Prints an empty XMLDocumentFragment object.
dfrag - The document fragment to be printed.
public void printElement(XMLElement elem)
Prints an XMLElement.
elem - The element to be printed.
Prints a XMLEntityReference node
public void printEntityReference(XMLEntityReference en)
en - The XMLEntityReference node.
Prints a XMLPI node
public void printProcessingInstruction(XMLPI pi)
pi - The XMLPI node.
Prints a XMLText node
public void printTextNode(XMLText text)
text - The text node.
Sets the encoding of the print driver.
public void setEncoding(java.lang.String enc)
enc - The encoding of the document being printed.
Interface in package oracle.xml.util.
Part of package oracle.xml.util. This interface provides Namespace support for Element and Attr names.
public interface NSName
Get the fully resolved name for this name
public java.lang.String getExpandedName()
The fully resolved name
Get the local name for this name
public java.lang.String getLocalName()
The local name
Get the resolved Namespace for this name
public java.lang.String getNamespace()
The resolved Namespace
Get the prefix for this name
public java.lang.String getPrefix()
The prefix
Get the qualified name
public java.lang.String getQualifiedName()
The qualified name
This class hold information about each attribute declared in an attribute list in the Document Type Definition.
public class AttrDecl implements java.io.Externalizable oracle.xml.parser.v2.AttrDecl
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/ decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public static final int REQUIRED public AttrDecl()
Gets attribute presence
public int getAttrPresence()
The presence of the attribute
Gets attribute type
public int getAttrType()
The type of the attribute
Gets attribute default value
public java.lang.String getDefaultValue()
The default value of the attribute
Gets attribute values
public java.util.Vector getEnumerationValues()
The values of the attribute as an Enumeration
Gets the name of the Attr Decl.
public java.lang.String getNodeName()
Name of the node
Gets a code representing the type of the underlying object
public short getNodeType()
type of the node
This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.
public void readExternal(java.io.ObjectInput inArg)
java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable
inArg - the ObjectInput stream used for reading the compressed stream.
IOException - is thrown when there is an error in reading the input stream.
ClassNotFoundException - is thrown when the class is not found
Gets a string representation of the attribute type
public static java.lang.String typeToString(int type)
A string representing the attribute type
This method saves the state of the object by creating a binary compressed stream with information about this object.
public void writeExternal(java.io.ObjectOutput outArg)
java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable
outArg - The ObjectOutput stream used to write the serialized/ compressed stream.
IOException - is thrown when there is an exception while writing the serialized/compressed stream.
This class implements the default behaviour 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.
public void cDATASection(char[] ch, int start, int length)
XMLDocumentHandler.cDATASection(char[], int, int) in interface XMLDocumentHandler
ch - The CDATA section characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive 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.
public void comment(java.lang.String data)
XMLDocumentHandler.comment(String) in interface XMLDocumentHandler
data - The comment data, or null if none was supplied.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of end of the DTD.
public void endDoctype()
XMLDocumentHandler.endDoctype() in interface XMLDocumentHandler
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of the end of an element.
public void endElement(NSName elem)
XMLDocumentHandler.endElement(NSName) in interface XMLDocumentHandler
elem - NSName object
SAXException - A SAXException could be thrown.
org.xml.sax.DocumentHandler#endElement
Receive notification of the end of an element.
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
End the scope of a prefix-URI mapping.
public void endPrefixMapping(java.lang.String prefix)
prefix - The prefix that was being mapping.
org.xml.sax.SAXException - The client may throw an exception during processing.
startPrefixMapping(String, String), endElement(NSName)
Get the next pipe-line node handler.
public XMLDocumentHandler getHandler()
XMLDocumentHandler.getHandler() in interface XMLDocumentHandler
The XMLDocumentHandler node
Receive notification of DTD. Sets the DTD.
public void setDoctype(DTD dtd)
XMLDocumentHandler.setDoctype(DTD) in interface XMLDocumentHandler
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of a XMLError handler.
public void setError(XMLError he)
XMLDocumentHandler.setError(XMLError) in interface XMLDocumentHandler
err - The XMLError object
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of a next pipe-line node handler.
public void setHandler(XMLDocumentHandler h)
XMLDocumentHandler.setHandler(XMLDocumentHandler) in interface XMLDocumentHandler
h - The XMLDocumentHandler node
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of a Text XML Declaration. The Parser will invoke this method once for each text XML Decl
public void setTextDecl(java.lang.String version, java.lang.String encoding)
XMLDocumentHandler.setTextDecl(String, String) in interface XMLDocumentHandler
version - The version number (or null, if not specified)
encoding - The encoding name
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of an XML Declaration. The Parser will invoke this method once for XML Decl.
public void setXMLDecl(java.lang.String version, java.lang.String standalone, java.lang.String encoding)
XMLDocumentHandler.setXMLDecl(String, String, String) in interface XMLDocumentHandler
version - The version number
standalone - The standalone value (or null, if not specifed)
encoding - The encoding name (or null, if not specifed)
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of a XMLSchema object.
public void setXMLSchema(java.lang.Object s)
XMLDocumentHandler.setXMLSchema(Object) in interface XMLDocumentHandler
s - The XMLSchema object
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of a skipped entity.
public void skippedEntity(java.lang.String name)
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]".
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of the beginning of an element.
public void startElement(NSNameelem,SAXAttrListattrlist)
XMLDocumentHandler.startElement(NSName, SAXAttrList) in interface XMLDocumentHandler
elem - NSName object
attrlist - SAXAttrList for the element
SAXException - A SAXException could be thrown.
org.xml.sax.DocumentHandler#startElement
Receive notification of the beginning of an element.
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
endElement(NSName), org.xml.sax.Attributes
Begin the scope of a prefix-URI Namespace mapping.
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
prefix - The Namespace prefix being declared.
uri - The Namespace URI the prefix is mapped to.
org.xml.sax.SAXException - The client may throw an exception during processing.
endPrefixMapping(String), startElement(NSName, SAXAttrList)
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 compatibilty
Default Constructor. Creates a document builder that can be used as XMLDocumentHandler
public DocumentBuilder()
Report an attribute type declaration.
public void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String valueDefault, java.lang.String value)
eName - The name of the associated element.
aName - The name of the attribute.
type - A string representing the attribute type.
valueDefault - A string representing the attribute default ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
value - A string representing the attribute's default value, or null if there is none.
SAXException - The application may raise an exception.
Receive notification of CDATA Section data inside an element.
public void cDATASection(char[] ch, int start, int length)
ch - The CDATA characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.DocumentHandler#characters
Receive notification of character data inside an element.
public void characters(char[] ch, int start, int length)
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.DocumentHandler#characters
Report an XML comment anywhere in the document.
public void comment(char[] ch, int start, int length)
ch - An array holding the characters in the comment.
start - The starting position in the array.
length - The number of characters to use from the array.
SAXException - The application may raise an exception.
Receive notification of a comment.
public void comment(java.lang.String data)
data - The comment data, or null if none was supplied.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Report an element type declaration.
public void elementDecl(java.lang.String name, java.lang.String model)
name - The element type name.
model - The content model as a normalized string.
SAXException - The application may raise an exception.
Report the end of a CDATA section.
public void endCDATA()
SAXException - The application may raise an exception.
startCDATA()
Receive notification of end of the DTD.
public void endDoctype()
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive notification of the end of the document.
public void endDocument()
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.DocumentHandler#endDocument
Report the end of DTD declarations.
public void endDTD()
SAXException - The application may raise an exception.
startDTD(String, String, String)
Receive notification of the end of an element.
public void endElement(NSName elem)
elem - NSName object
SAXException - A SAXException could be thrown.
org.xml.sax.DocumentHandler#endElement
Receive notification of the end of an element.
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Report the end of an entity.
public void endEntity(java.lang.String name)
name - The name of the entity that is ending.
SAXException - The application may raise an exception.
startEntity(String)
Report a parsed external entity declaration.
public void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
name - The name of the entity. If it is a parameter entity, the name will begin with '%'.
publicId - The declared public identifier of the entity, or null if none was declared.
systemId - The declared system identifier of the entity.
SAXException - The application may raise an exception.
internalEntityDecl(String, String), org.xml.sax.DTDHandler#unparsedEntityDecl
Get the current node being build
public XMLNode getCurrentNode()