| 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()
XMLNode
Get the document being build
public XMLDocument getDocument()
XMLDocument
Receive notification of ignorable whitespace in element content.
public void ignorableWhitespace(char[] ch, int start, int length)
ch - The whitespace 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#ignorableWhitespace
Report an internal entity declaration.
public void internalEntityDecl(java.lang.String name, java.lang.String value)
name - The name of the entity. If it is a parameter entity, the name will begin with '%'.
value - The replacement text of the entity.
SAXException - The application may raise an exception.
externalEntityDecl(String, String, String), org.xml.sax.DTDHandler#unparsedEntityDecl
Receive notification of a processing instruction.
public void processingInstruction(java.lang.String target, java.lang.String data)
target - The processing instruction target.
data - The processing instruction data, or null if none is supplied.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.DocumentHandler#processingInstruction
Sets a flag to retain CDATA sections
public void retainCDATASection(boolean flag)
flag - determines whether CDATA sections are retained
Sets a flag to turn on debug information in the document
public void setDebugMode(boolean flag)
flag - determines whether debug info is stored
Receive notification of DTD Sets the DTD
public void setDoctype(DTD dtd)
dtd - set the DTD for the document
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Receive a 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)
locator - A locator for all SAX document events.
org.xml.sax.DocumentHandler#setDocumentLocator, org.xml.sax.Locator
Set a optional NodeFactory to be used for creating custom DOM trees
public void setNodeFactory(NodeFactory f)
f - NodeFactory
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)
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 a 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)
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.
Report the start of a CDATA section.
public void startCDATA()
SAXException - The application may raise an exception.
endCDATA()
Receive notification of the beginning of the document.
public void startDocument()
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.DocumentHandler#startDocument
Report the start of DTD declarations, if any.
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
name - The document type name.
publicId - The declared public identifier for the external DTD subset, or null if none was declared.
systemId - The declared system identifier for the external DTD subset, or null if none was declared.
SAXException - The application may raise an exception.
endDTD(), startEntity(String)
Receive notification of the beginning of an element.
public void startElement(NSNameelem,SAXAttrListattrlist)
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)
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 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
Report the beginning of some internal and external XML entities. All start/endEntity events must be properly nested.
public void startEntity(java.lang.String name)
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]".
SAXException - The application may raise an exception.
endEntity(String), org.xml.sax.ext.DeclHandler, org.xml.sax.ext.DeclHandler
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()
Allows the user to retrieve specific attributes on the underlying implementation.
public java.lang.Object getAttribute(java.lang.String name)
name - The name of the attribute.
value The value of the attribute.
IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.
Get the DTD
public DTD getDoctype()
The DTD
Gets the document
public XMLDocument getDocument()
The document being parsed
Parses the XML External DTD from given input source
public final void parseDTD(org.xml.sax.InputSource in, java.lang.String rootName)
in - the org.xml.sax.InputSouce to parse
rootName - the element to be used as root Element
XMLParseException - if syntax or other error encountered.
SAXException - Any SAX exception, possibly wrapping another exception.
IOException - IO Error.
Parses the XML External DTD from given input stream. The base URL should be set for resolving external entities and DTD.
public final void parseDTD(java.io.InputStream in, java.lang.String rootName)
in - the InputStream containing XML data to parse.
rootName - the element to be used as root Element
XMLParseException - if syntax or other error encountered.
SAXException - Any SAX exception, possibly wrapping another exception.
IOException - IO Error.
XMLParser.setBaseURL(URL)
Parses the XML External DTD from given input stream. The base URL should be set for resolving external entities and DTD.
public final void parseDTD(java.io.Reader r, java.lang.String rootName)
r - the Reader containing XML data to parse.
rootName - the element to be used as root Element
XMLParseException - if syntax or other error encountered.
SAXException - Any SAX exception, possibly wrapping another exception.
IOException - IO Error.
XMLParser.setBaseURL(URL)
Parses the XML External DTD from the URL indicated
public final void parseDTD(java.lang.String in, java.lang.String rootName)
in - the String containing the URL to parse from
rootName - the element to be used as root Element
XMLParseException - if syntax or other error encountered.
SAXException - Any SAX exception, possibly wrapping another exception.
IOException - IO Error.
Parses the XML External DTD document pointed to by the given URL and creates the corresponding XML document hierarchy.
public final void parseDTD(java.net.URL url, java.lang.String rootName)
url - the url points to the XML document to parse.
rootName - the element to be used as root Element
XMLParseException - if syntax or other error encountered.
SAXException - Any SAX exception, possibly wrapping another exception.
IOException - IO Error.
Resets the parser state.
public void reset()
Switch to determine whether to retain CDATA sections
public void retainCDATASection(boolean flag)
flag - TRUE - keep CDATASections (default) FALSE - convert CDATASection to Text nodes
Allows the user to set specific attributes on the underlying implementation.
public void setAttribute(java.lang.String name, java.lang.Object value)
name - The name of the attribute.
value - The value of the attribute.
IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.
Sets a flag to turn on debug information in the document
public void setDebugMode(boolean flag)
flag - determines whether debug info is stored
Creates an output stream for the output of errors and warnings. If an output stream for errors is not specified, the parser will use the standard error output stream System.err for outputting errors and warnings.
public final void setErrorStream(java.io.OutputStream out)
out - The output stream to use for errors and warnings
Creates an output stream for the output of errors and warnings. If an output stream for errors is not specified, the parser will use the standard error output stream System.err for outputting errors and warnings. Additionally, an .exception is thrown if the encoding specified is unsupported.
public final void setErrorStream(java.io.OutputStream out, java.lang.String enc)
out - The output stream to use for errors and warnings
enc - the encoding to use
IOException - if an unsupported encoding is specified
Creates an output stream for the output of errors and warnings. If an output stream for errors is not specified, the parser will use the standard error output stream System.err for outputting errors and warnings.
public final void setErrorStream(java.io.PrintWriter out)
out - The PrintWriter to use for errors and warnings
IOException - if I/O error occurs in setting the error stream.
Set the node factory. Applications can extend the NodeFactory and register it through this method. The parser will then use the user supplied NodeFactory to create nodes of the DOM tree.
public void setNodeFactory(NodeFactory factory)
factory - The NodeFactory to set
XMLParseException - if an invalid factory is set
NodeFactory
Switch to determine whether to print warnings.
public void showWarnings(boolean flag)
flag - determines whether warnings should be shown
Implements the DOM DocumentType interface and holds the Document Type. Definition information for an XML document.
public class DTD implements java.io.Externalizable oracle.xml.parser.v2.DTD
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 DTD()
Finds an element declaration for the given tag name.
public final ElementDecl findElementDecl(java.lang.String name)
name - The tag name.
the element declaration object.
Finds a named entity in the DTD.
public final org.w3c.dom.Entity findEntity(java.lang.String n, boolean par)
n - The name of the entity.
par - Boolean indicating if the entitiy is parameter Entity.
The specified Entity object; returns null if it is not found.
Retrieves the named notation from the DTD.
public final org.w3c.dom.Notation findNotation(java.lang.String name)
name - The name of the notation.
the Notation object; returns null if it is not found.
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes. The content of the returned NodeList is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList accessors; it is not a static snapshot of the content of the node. This is true for every NodeList, including the ones returned by the getElementsByTagName method.
public org.w3c.dom.NodeList getChildNodes()
The children of this node
A NamedNodeMap containing the element declarations in the DTD. Every node in this map is an ElementDecl object.
public org.w3c.dom.NamedNodeMap getElementDecls()
The element declarations in the DTD The DOM Level 1 does not support editing elementdecls, therefore elementdecls cannot be altered in any way.
A NamedNodeMap containing the general entities, both external and internal, declared in the DTD. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY % baz "baz">]> <ex/> the interface provides access to foo and bar but not baz. Every node in this map also implements the Entity interface. The DOM Level 1 does not support editing entities, therefore entities cannot be altered in any way.
public org.w3c.dom.NamedNodeMap getEntities()
The entities declared in the DTD
Gets the internal subset of the DTD
public java.lang.String getInternalSubset()
The internal subset declarations as a string
Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.
public java.lang.String getName()
Name of the DTD
Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.
public java.lang.String getNodeName()
Name of the DTD
Gets a code representing the type of the underlying object
public short getNodeType()
type of the node
A NamedNodeMap containing the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements the Notation interface. The DOM Level 1 does not support editing notations, therefore notations cannot be altered in any way.
public org.w3c.dom.NamedNodeMap getNotations()
The notations declared in the DTD
Gets the owner of the DTD implementation.
public XMLDOMImplementation getOwnerImplementation()
the Implementation this DTD was created from
DOM 2
Gets The public identifier associated with the DTD, if specified. If the public identifier was not specified, this is null.
public java.lang.String getPublicId()
the public identifier associated with the DTD
Get the root tag for the DTD
public java.lang.String getRootTag()
root tag
Gets the system identifier associated with the DTD, if specified. If the system identifier was not specified, this is null.
public java.lang.String getSystemId()
the system identifier associated with the DTD
This is a convenience method to allow easy determination of whether a node has any children. return false always, as DTD cannot have any overrides method in XMLNode
public boolean hasChildNodes()
false as DTD node can not have any children,
Normalize the DTD.
public void normalize()
DOM 2
Writes the contents of this document to the given output stream.
public void printExternalDTD(java.io.OutputStream out)
out - OutputStream to write to
IOException - if an error occurs
Writes the contents of the external DTD to the given output stream.
public void printExternalDTD(java.io.OutputStream out, java.lang.String enc)
Writes the contents of the external DTD to the given output stream.
out - OutputStream to write to
enc - Encoding to use for the output
IOException - if an invalid encoding was specified or if any other error occurs
Writes the contents of this document to the given output stream.
public void printExternalDTD(java.io.PrintWriter out)
out - PrintWriter to write to
IOException - if an error occurs
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.
Set the root tag for the DTD
public void setRootTag(java.lang.String root)
root - the root tag
This method saves the state of the object by creating a binray 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 represents an element declaration in a DTD.
public class ElementDecl implements java.io.Serializable, java.io.Externalizable oracle.xml.parser.v2.ElementDecl
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 ElementDecl()
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode returns null.). Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node.
public org.w3c.dom.Node cloneNode(boolean deep)
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
The duplicate node.
Returns vector of element names that can be appended to the element.
public java.util.Vector expectedElements(org.w3c.dom.Element e)
e - Element
Vector of names
Gets an attribute declaration object or null if not found
public final AttrDecl findAttrDecl(java.lang.String name)
name - Attribute declaration to find
The AttrDecl object, or null, if it was not found
Gets an enumeration of attribute declarations
public org.w3c.dom.NamedNodeMap getAttrDecls()
An enumeration of attribute declarations
Returns Vector of elements that can be appended to this element
public final java.util.Vector getContentElements()
The Vector containing the element names.
Returns content model of element
public int getContentType()
The type of the element declaration.
Gets the name of the Element 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
Returns the root node of Content Model Parse Tree. Node.getFirstChild() and Node.getLastChild() return the the parse tree branches. Node.getNodeType() and Node.getNodeName() return the the parse tree node type and name.
public final org.w3c.dom.Node getParseTree()
The Node containing the Content Model parse tree root 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
in - 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
Validates the content of a element node.
public boolean validateContent(org.w3c.dom.Element e)
True if valid, else false
This method saves the state of the object by creating a binray 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
out - 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 specifies methods to create various nodes of the DOM tree built during parsing. Applications can override these methods to create their own custom classes to be added to the DOM tree while parsing. Applications have to register their own NodeFactory using the XMLParser's setNodeFactory() method. If a null pointer is returned by these methods, then the node will not be added to the DOM tree.
public class NodeFactory extends java.lang.Object implements java.io.Serializable java.lang.Object | +--oracle.xml.parser.v2.NodeFactory
java.io.Serializable
DOMParser.setNodeFactory(NodeFactory)
public NodeFactory()
Creates an attribute node with the specified tag, and text.
public XMLAttr createAttribute(java.lang.String tag, java.lang.String text)
tag - The name of the node.
text - The text associated with the node.
The created attribute node.
Creates an attribute node with the specified tag, and text.
public XMLAttr createAttribute(java.lang.String localName, java.lang.String
prefix, java.lang.String namespaceURI, java.lang.String value)
localName - the name of the node.
prefix - the prefix of the node.
namespaceURI - the namespace of the node
value - The value associated with the node.
The created attribute node.
Creates a CDATA node with the specified text.
public XMLCDATA createCDATASection(java.lang.String text)
text - The text associated with the node.
The created CDATA node.
Creates a comment node with the specified text.
public XMLComment createComment(java.lang.String text)
text - The text associated with the node.
The created comment node.
Creates a document node. This method cannot return a null pointer.
public XMLDocument createDocument()
The created element.
Creates a document fragment node with the specified tag.
public XMLDocumentFragment createDocumentFragment()
The created document fragment node.
Creates an Element node with the specified tag.
public XMLElement createElement(java.lang.String tag)
tag - The name of the element.
The created element.
Creates an Element node with the specified local name,prefix , namespaceURI
public XMLElement createElementNS(java.lang.String localName, java.lang.String
prefix, java.lang.String namespaceURI)
localName - the name of the element
prefix - the prefix of the element,
namespaceURI - the namespace of the element
The created element.
Creates an entity reference node with the specified tag.
public XMLEntityReference createEntityReference(java.lang.String tag)
tag - The name of the node.
The created entity reference node.
Creates a PI node with the specified tag, and text.
public XMLPI createProcessingInstruction(java.lang.String tag, java.lang.String
text)
tag - The name of the node.
text - The text associated with the node.
The created PI node.
Creates a text node with the specified text.
public XMLText createTextNode(java.lang.String text)
text - The text associated with the node.
The created text node.
The oraxml class provides a command-line interface to validate XML files
public class oraxml extends java.lang.Object java.lang.Object | +--oracle.xml.parser.v2.oraxml
public oraxml()
public static void main(java.lang.String[] args)
This class implements the SAX AttributeList interface and also provides Namespace support. Applications that require Namespace support can explicitly cast any attribute list returned by an Oracle parser class to SAXAttrList and use the methods described here. It also implements Attributes (SAX 2.0) interface
public class SAXAttrList oracle.xml.parser.v2.SAXAttrList
This interface allows access to a list of attributes in three different ways:
The list will not contain attributes that were declared #IMPLIED but not specified in the start tag. It will also not contain attributes used as Namespace declarations (xmlns*) unless the http://xml.org/sax/features/namespace-prefixes feature is set to true (it is false by default).
If the namespace-prefixes feature (see above) is false, access by qualified name may not be available; if the http://xml.org/sax/features/namespaces feature is false, access by Namespace-qualified names may not be available.
This interface replaces the now-deprecated SAX1 interface, which does not contain Namespace support. In addition to Namespace support, it adds the getIndex methods (below).
The order of attributes in the list is unspecified, and will vary from implementation to implementation.
public SAXAttrList(int elems)
Add an attribute to the parent element node.
public void addAttr(java.lang.String pfx, java.lang.String lname, java.lang.String tag, java.lang.String value, boolean spec, int type)
pfx - the prefix of the attribute
lname - the local name of the attribute
tag - the qname of the attribute
value - the attribute value
spec - the specified flag
type - the attribute type
Add an attribute to the parent element node.
public void addAttr(java.lang.String pfx, java.lang.String lname, java.lang.String tag, java.lang.String value, boolean spec, int type, java.lang.String nmsp)
pfx - the prefix of the attribute
lname - the local name of the attribute
tag - the qname of the attribute
value - the attribute value
spec - the specified flag
type - the attribute type #param nmsp the namespace of the attribute
Get the expanded name for an attribute in the list (by position)
public java.lang.String getExpandedName(int i)
i - The index of the attribute in the list.
The expanded name for the attribute
Look up the index of an attribute by XML 1.0 qualified name.
public int getIndex(java.lang.String qName)
qName - The qualified (prefixed) name.
The index of the attribute, or -1 if it does not appear in the list.
Look up the index of an attribute by Namespace name.
public int getIndex(java.lang.String uri, java.lang.String localPart)
uri - The Namespace URI, or the empty string if the name has no Namespace URI.
localName - The attribute's local name.
The index of the attribute, or -1 if it does not appear in the list.
SAX2
Return the number of attributes in this list.
public int getLength()
The SAX parser may provide attributes in any arbitrary order, regardless of the order in which they were declared or specified. The number of attributes may be zero.
The number of attributes in the list.
Look up an attribute's local name by index.
public java.lang.String getLocalName(int index)
index - The attribute index (zero-based).
The local name, or the empty string if Namespace processing is not being performed, or null if the index is out of range.
SAX2
getLength()
Get the namespace prefix for an attribute in the list (by position)
public java.lang.String getPrefix(int i)
i - The index of the attribute in the list.
The namespace prefix for the attribute
Look up an attribute's XML 1.0 qualified name by index.
public java.lang.String getQName(int index)
index - The attribute index (zero-based).
The XML 1.0 qualified name, or the empty string if none is available, or null if the index is out of range.
SAX2
getLength()
Look up an attribute's type by index.
public java.lang.String getType(int index)
The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case).
If the parser has not read a declaration for the attribute, or if the parser does not report attribute types, then it must return the value "CDATA" as stated in the XML 1.0 Recommentation (clause 3.3.3, "Attribute-Value Normalization").
For an enumerated attribute that is not a notation, the parser will report the type as "NMTOKEN".
index - The attribute index (zero-based).
The attribute's type as a string, or null if the index is out of range.
getLength()
Look up an attribute's type by XML 1.0 qualified name.
public java.lang.String getType(java.lang.String qName)
See getType(int) for a description of the possible types.
qName - The XML 1.0 qualified name.
The attribute type as a string, or null if the attribute is not in the list or if qualified names are not available.
Look up an attribute's type by Namespace name.
public java.lang.String getType(java.lang.String uri, java.lang.String localName)
See getType(int) for a description of the possible types.
uri - The Namespace URI, or the empty String if the name has no Namespace URI.
localName - The local name of the attribute.
The attribute type as a string, or null if the attribute is not in the list or if Namespace processing is not being performed.
SAX2
Look up an attribute's Namespace URI by index.
public java.lang.String getURI(int index)
index - The attribute index (zero-based).
The Namespace URI, or the empty string if none is available, or null if the index is out of range.
SAX2
getLength()
Look up an attribute's value by index.
public java.lang.String getValue(int index)
If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will be concatenated into a single string with each token separated by a single space.
index - The attribute index (zero-based).
The attribute's value as a string, or null if the index is out of range.
getLength()
Look up an attribute's value by XML 1.0 qualified name.
public java.lang.String getValue(java.lang.String qName)
See getValue(int) for a description of the possible values.
qName - The XML 1.0 qualified name.
The attribute value as a string, or null if the attribute is not in the list or if qualified names are not available.
Look up an attribute's value by Namespace name.
public java.lang.String getValue(java.lang.String uri, java.lang.String localName)
See getValue(int) for a description of the possible values.
uri - The Namespace URI, or the empty String if the name has no Namespace URI.
localName - The local name of the attribute.
The attribute value as a string, or null if the attribute is not in the list.
SAX2
Resets the SAXAttrList
public void reset()
public class SAXParser oracle.xml.parser.v2.SAXParser
This class implements an eXtensible Markup Language (XML) 1.0 SAX parser according to the World Wide Web Consortium (W3C) recommendation. Applications can register a SAX handler to receive notification of various parser events.
XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse.
All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.
This interface replaces the (now deprecated) SAX 1.0 Parser interface. The XMLReader interface contains two important enhancements over the old Parser interface:
Creates a new parser object.
public SAXParser()
Return the current content handler.
public org.xml.sax.ContentHandler getContentHandler()
The current content handler, or null if none has been registered.
SAX 2.0
setContentHandler(ContentHandler)
Return the current DTD handler.
public org.xml.sax.DTDHandler getDTDHandler()
The current DTD handler, or null if none has been registered.
SAX 2.0
setDTDHandler(DTDHandler)
Look up the value of a feature.
public boolean getFeature(java.lang.String name)
The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but to be unable to return its value; this is especially true in the case of an adapter for a SAX1 Parser, which has no way of knowing whether the underlying parser is performing validation or expanding external entities.
All XMLReaders are required to recognize the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.
Some feature values may be available only in specific contexts, such as before, during, or after a parse.
Typical usage is something like this:
XMLReader r = new MySAXDriver(); // try to activate validation try { r.setFeature("http://xml.org/sax/features/validation", true); } catch (SAXException e) { System.err.println("Cannot activate validation."); } // register event handlers r.setContentHandler(new MyContentHandler()); r.setErrorHandler(new MyErrorHandler()); // parse the first document try { r.parse("http://www.foo.com/mydoc.xml"); } catch (IOException e) { System.err.println("I/O exception reading XML document"); } catch (SAXException e) { System.err.println("XML exception reading document."); }
The feature "http://xml.org/sax/features/validation" due to its binary input value only controls DTD validation. The value true sets DTD validation to TRUE. This feature cannot be used to control XML Schema based validation.
Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.
feature - Name of the feature, which is a fully-qualified URI.
version - Version of the feature.
The current state of the feature (true or false).
org.xml.sax.SAXNotRecognizedException - When the XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - When the XMLReader recognizes the feature name but cannot determine its value at this time.
setFeature(String, boolean)
Look up the value of a property.
public java.lang.Object getProperty(java.lang.String name)
The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to return its state; this is especially true in the case of an adapter for a SAX1 Parser .
XMLReaders are not required to recognize any specific property names, though an initial core set is documented for SAX2.
Some property values may be available only in specific contexts, such as before, during, or after a parse.
Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.
name - The property name, which is a fully-qualified URI.
The current value of the property.
org.xml.sax.SAXNotRecognizedException - When the XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - When the XMLReader recognizes the property name but cannot determine its value at this time.
setProperty(String, Object)
Allow an application to register a content event handler.
public void setContentHandler(org.xml.sax.ContentHandler handler)
If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler - The content handler.
java.lang.NullPointerException - If the handler argument is null.
SAX 2.0
getContentHandler()
Allow an application to register a DTD event handler.
public void setDTDHandler(org.xml.sax.DTDHandler handler)
If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler - The DTD handler.
java.lang.NullPointerException - If the handler argument is null.
getDTDHandler()
Set the state of a feature.
public void setFeature(java.lang.String name, boolean value)
The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but to be unable to set its value; this is especially true in the case of an adapter for a SAX1 Parser , which has no way of affecting whether the underlying parser is validating, for example.
All XMLReaders are required to support setting http://xml.org/sax/features/namespaces to true and http://xml.org/sax/features/namespace-prefixes to false.
Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.
The feature "http://xml.org/sax/features/validation" due to its binary input value only controls DTD validation. The value true sets DTD validation to TRUE. This feature cannot be used to control XML Schema based validation
name - The feature name, which is a fully-qualified URI.
state - The requested state of the feature (true or false).
org.xml.sax.SAXNotRecognizedException - When the XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - When the XMLReader recognizes the feature name but cannot set the requested value.
getFeature(String)
Set the value of a property.
public void setProperty(java.lang.String name, java.lang.Object value)
The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to set its value; this is especially true in the case of an adapter for a SAX1 Parser .
XMLReaders are not required to recognize setting any specific property names, though a core set is provided with SAX2.
Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.
This method is also the standard mechanism for setting extended handlers.
name - The property name, which is a fully-qualified URI.
state - The requested value for the property.
org.xml.sax.SAXNotRecognizedException - When the XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - When the XMLReader recognizes the property name but cannot set the requested value.
public class XMLAttr implements oracle.xml.parser.v2.NSName,
java.io.Externalizable
oracle.xml.parser.v2.XMLAttr
java.io.Externalizable, NSName, oracle.xml.util.NSName, java.io.Serializable
This class implements the DOM Attr interface and holds information on each attribute of an element.
Attr,NodeFactory,DOMParser.setNodeFactory(NodeFactory)
Default constructor.
public XMLAttr()
Deprecated. Use createAttribute(String) or createAttributeNS(String, String) of XMLDocument
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. For all normal XMLAttr creation use createAttribute(String) or createAttributeNS(String, String) of XMLDocument
Construct attribute with given name and value.
public XMLAttr(java.lang.String n, java.lang.String v)
Deprecated; use createAttribute(String) method of XMLDocument
n - Name of the attribute
v - Value of the attribute
Namespace support
public XMLAttr(java.lang.String name, java.lang.String prefix, java.lang.String namespace, java.lang.String v)
Deprecated; use createAttributeNS(String, String) method of XMLDocument
name - Local name of the attribute
prefix - Prefix of the attribute
namespace - Namespace of the attribute
v - Value of the attribute
private constructor (doesn't intern names)
public XMLAttr(java.lang.String name, java.lang.String prefix, java.lang.String qname, java.lang.String namespace, java.lang.String v)
Deprecated; use crateAttribute(String) or createAttributeNS(String, String) of XMLDocument
name - Local name of the attribute
prefix - Prefix of the attribute
qname - Qname of the attribute
namespace - Namespace of the attribute
v - Value of the attribute
public XMLNode addText(java.lang.String str)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
public org.w3c.dom.Node cloneNode(boolean deep)
The duplicate node has no parent ( parentNode returns null.). Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node.
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
The duplicate node.
Gets the fully resolved Name for this attribute
public java.lang.String getExpandedName()
oracle.xml.util.NSName.getExpandedName() in interface oracle.xml.util.NSName
the fully resolved Name
Gets the local name of this attribute
public java.lang.String getLocalName()
oracle.xml.util.NSName.getLocalName() in interface oracle.xml.util.NSName
the local Name for this attribute
DOM 2
Gets the attribute name.
public java.lang.String getName()
attribute name
Gets the namespace of the attribute
public java.lang.String getNamespaceURI()
the namespace URI associated with this attribute
DOM 2
Gets the next attribute if any
public XMLAttr getNextAttribute()
the next attribute
public org.w3c.dom.Node getNextSibling()
Gets a code representing the type of the underlying object
public short getNodeType()
type of the node
Gets the value of this node, depending on its type
public java.lang.String getNodeValue()
Value of this node
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
Gets the element which owns this attribute
the element node that owns this attribute
DOM 2
Gets the parent of this node.
public org.w3c.dom.Node getParentNode()
All nodes, except Document, DocumentFragment, and Attr may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.
The parent of this node
Gets the name space prefix of the element
public java.lang.String getPrefix()
oracle.xml.util.NSName.getPrefix() in interface oracle.xml.util.NSName
the namespace prefix for this attribute
DOM 2
public org.w3c.dom.Node getPreviousSibling()
Returns true if the attribute was specified explicity in the element
public boolean getSpecified()
true, if the attribute was specified explicitly, false, if it was not
Gets the attribute value.
public java.lang.String getValue()
attribute value
This method restores the information written by writeExternal.
public void readExternal(java.io.ObjectInput inArg)
java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable
inArg - is the ObjectInput stream used to read the compressed stream
IOException - is thrown when there is an exception while reading the compressed stream.
ClassNotFoundException - is thrown when the class is not found
Sets the value of this node, depending on its type
public void setNodeValue(java.lang.String nodeValue)
nodeValue - the value of thenode to be set
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
Sets the value.
public void setValue(java.lang.String arg)
arg - Value to set
This method saves the state of the object. The object information is saved in a binary compressed stream.
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 compressed stream
IOException - is thrown when there is an exception while writing the compressed stream.
This class implements the DOM CDATASection interface.
public class XMLCDATA implements java.io.Externalizable oracle.xml.parser.v2.XMLCDATA
java.io.Externalizable, java.io.Serializable
CDATASection,NodeFactory,DOMParser.setNodeFactory(NodeFactory)
Default constructor.
public XMLCDATA()
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.
Gets a name of the node
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
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 - is the ObjectOutput stream used to write the compressed stream.
IOException - is thrown when there is an exception while writing the compressed stream.
This class implements the DOM Comment interface.
public class XMLComment implements java.io.Externalizable oracle.xml.parser.v2.XMLComment
java.io.Externalizable, java.io.Serializable
Comment,NodeFactory,DOMParser.setNodeFactory(NodeFactory)
Default constructor.
public XMLComment()
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.
Adds the comment text
public XMLNode addText(java.lang.String str)
str - the comment text
Gets a name of the node
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
Report SAX Events from a DOM Tree
public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)
ContentHandler - cntHandler
SAXException - thrown by SAX Callback functions
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 - is the ObjectOutput stream used to write the compressed stream.
IOException - is thrown when there is an exception while writing the compressed stream.
This class implements the XML Decl Processing Instruction.
public class XMLDeclPI extendsoracle.xml.parser.v2.XMLPIimplements java.io.Externalizableoracle.xml.parser.v2.XMLPI| +--oracle.xml.parser.v2.XMLDeclPI
java.io.Externalizable, java.io.Serializable
ProcessingInstruction
public XMLDeclPI()
public XMLDeclPI(java.lang.String version, java.lang.String encoding, java.lang.String standalone, boolean textDecl)
Returns a duplicate of this node, i.e., serves as a generic copy
public org.w3c.dom.Node cloneNode(boolean deep)
The duplicate node.
Returns the fully constructed string 'version=1.0 ....'
public java.lang.String getData()
the nodevalue
DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
Retrieves the character encoding information.
public final java.lang.String getEncoding()
the encoding information stored in the <?xml ...?> tag or the user-defined output encoding if it has been more recently set.
Gets the value of this node
public java.lang.String getNodeValue()
the nodevalue
DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation
Retrieves the standalone information.
public final java.lang.String getStandalone()
the standalone attribute stored in the <?xml ...?> tag.
Retrieves the version information.
public final java.lang.String getVersion()
the version number stored in the <?xml ...?> tag.
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
java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable
XMLPI.readExternal(ObjectInput) in class XMLPI
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
Sets the character encoding for output.
public final void setEncoding(java.lang.String encoding)
Eventually it sets the ENCODING stored in the <?xml ...?> tag, but not until the document is saved. You should not call this method until the Document has been loaded.
encoding - The character encoding to set
Sets the standalone information stored in the <?xml ...?> tag.
public final boolean setStandalone(java.lang.String value)
value - The attribute value ('yes' or 'no').
Sets the version number stored in the <?xml ...?> tag.
public final void setVersion(java.lang.String version)
version - The version information to set.
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
XMLPI.writeExternal(ObjectOutput) in class XMLPI
outArg - is the ObjectOutput stream used to write the compressed stream.
IOException - is thrown when there is an exception while writing the compressed stream.
This class implements the DOM Document interface, represents an entire XML document and serves the root of the Document Object Model tree. Each XML tag can either represent a node or a leaf of this tree.
public class XMLDocument implements java.io.Externalizable oracle.xml.parser.v2.XMLDocument
java.io.Externalizable, java.io.Serializable
According to the XML specification, the root of the tree consists of any combination of comments and processing instructions, but only one root element. A helper method getDocumentElement is provided as a short cut to finding the root element.
Creates an empty document.
public XMLDocument()
Add a ID Element associated with this document
public void addID(java.lang.String name, XMLElement e)
id - String - id value
e - XMLElement associated with id
Adopts a node from another document to this document.
public org.w3c.dom.Node adoptNode(org.w3c.dom.Node srcNode)
The returned node has no parent; (parentNode is null). The source node is removed from the original document;
Node - to be adopted
Node with document association updated
DOMException - NOT_SUPPORTED_ERR: Raised if the type of the node being adopted is not supported.
DOM 2
Appends a new node to the document
public org.w3c.dom.Node appendChild(org.w3c.dom.Node elem)
the - new node to be added
the node after appending it to the document
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the elem node. WRONG_DOCUMENT_ERR: Raised if elem was created from a different document than this one.
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
public org.w3c.dom.Node cloneNode(boolean deep)
The duplicate node has no parent ( parentNode returns null.). Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node.
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
The duplicate node.
Creates an Attr of the given name.
public org.w3c.dom.Attr createAttribute(java.lang.String name)
Note that the Attr instance can then be set on an Element using the setAttribute method.
name - The name of the attribute.
A new Attr object.
DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
Creates an attribute with the given qualified name and namespace URI.
public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
namespaceURI - namespace of the attribute/element to be created
qualifiedName - qualified name of the attribute/element to be created
Element node with given qualified name and namespace URI
DOMException - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains illegal Characters NAMESPACE_ERR : Raised if the qualified name is malformed, if the qualified name has a prefix and the namespace URI is null or an empty string,or if the qulaifiedName has a prefix that is "xml" and namespace URI is different from "http://www.w3.org/2000/xmlns/"
DOM 2
Creates a CDATASection node whose value is the specified string.
public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
data - The data for the CDATASection contents.
The new CDATASection object.
DOMException - A DOMException could be thrown.
Creates a Comment node given the specified string.
public org.w3c.dom.Comment createComment(java.lang.String data)
data - The data for the node.
The new Comment object.
Creates an empty DocumentFragment object.
public org.w3c.dom.DocumentFragment createDocumentFragment()
A new DocumentFragment.
Creates an element of the type specified.
public org.w3c.dom.Element createElement(java.lang.String tagName)
Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.
tagName - The name of the element type to instantiate. The name is treated as case-sensitive.
A new Element object.
DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
Creates an element of the given qualified name and namespace URI.
public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
namespaceURI - namespace of the attribute/element to be created
qualifiedName - qualified name of the attribute/element to be created
Element node with given qualified name and namespace URI
DOMException - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains illegal Characters NAMESPACE_ERR : Raised if the qualified name is malformed, if the qualified name has a prefix and the namespace URI is null or an empty string,or if the qulaifiedName has a prefix that is "xml" and namespace URI is different from "http://www.w3.org/XML/1998/namespace"
DOM 2
Creates an EntityReference object.
public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
name - The name of the entity to reference.
The new EntityReference object.
DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
Creates an event object of the specified type
public org.w3c.dom.events.Event createEvent(java.lang.String type)
type - the type of the event
Event object of the specified type
Creates a Mutation Event object of specified type
public org.w3c.dom.events.MutationEvent createMutationEvent(java.lang.String type)
type - the type of the mutation event
Event object of the specified type
Creates a Node Iterator with specified root,flag which governs what type of nodes it should include in logical view, filter for filtering nodes, flag determining whether entity references and its descendants could be included
public org.w3c.dom.traversal.NodeIterator createNodeIterator(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean expandEntityReferences)
root - root node of the iterator.
whatToShow - flag indicating what type of nodes will be included in the iterator/tree walker.
filter - NodeFilter to filter unwanted nodes from the iterator/tree walker.
expandEntityReference - flag to indicate traversal of entity references.
object that implements NodeIterator interface,created on this document
DOMException - NOT_SUPPORTED_ERR: if the NodeIterator could not be created with specified root
Creates a ProcessingInstruction node given the specified name and data strings.
public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
target - The target part of the processing instruction.
data - The data for the node.
The new ProcessingInstruction object.
DOMException - INVALID_CHARACTER_ERR: Raised if an invalid character is specified.
Create a new Document Range Object ,with Start and End Boundary points at the begining of the document.
public org.w3c.dom.ranges.Range createRange()
new Range object with start and end boundary points at the begining of the document
Creates a Range Event object of specified type
public org.w3c.dom.events.Event createRangeEvent(java.lang.String type)
type - the type of the event
Event object of the specified type
Creates a Text node given the specified string.
public org.w3c.dom.Text createTextNode(java.lang.String data)
data - The data for the node.
The new Text object.
Creates a Traversal Event object of specified type
public org.w3c.dom.events.Event createTraversalEvent(java.lang.String type)
type - the type of the event
Event object of the specified type
Creates a Node Iterator with specified root,flag which governs what type of nodes it should include in logical view, filter for filtering nodes, flag determining whether entity references and its descendants could be included
public org.w3c.dom.traversal.TreeWalker createTreeWalker(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean expandEntityReferences)
root - root node of the iterator.
whatToShow - flag indicating what type of nodes will be included in the iterator/tree walker.
filter - NodeFilter to filter unwanted nodes from the iterator/tree walker
expandEntityReference - flag to indicate traversal of entity references
an object that implements TreeWalker interface,created on this document
DOMException - NOT_SUPPORTED_ERR: if the NodeIterator could not be created with specified root
Returns vector of element names that can be appended to the element.
public java.util.Vector expectedElements(org.w3c.dom.Element e)
e - Element
Vector of names
Get column number debug information
public int getColumnNumber()
column the column number
Get the debug flag
public boolean getDebugMode()
boolean flag
The Document Type Declaration (DTD) associated with this document. For XML documents without a DTD, this returns null.
public org.w3c.dom.DocumentType getDoctype()
Note that the DOM Level 1 specification does not support editing the DTD.
The associated DTD
org.w3c.dom.DocumentType
This is a convenience attribute that allows direct access to the child node that is the root element of the document.
public org.w3c.dom.Element getDocumentElement()
The root element
Returns the Element whose ID is given by elementId. If no such element exists, returns null. Behavior is not defined if more than one element has this ID.
public org.w3c.dom.Element getElementById(java.lang.String elementId)
String - elementId used to get the matching Id Element
The matching Id Element if one exists or null if none exists
DOM 2
Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.
public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
tagname - The name of the tag to match on. The special value "*" matches all tags.
A new NodeList object containing all the matched Elements.
Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree.
public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
namespaceURI - namespace of the elements requested.
localName - local name of the element requested.
nodelist of matching elements
DOM 2
Retrieves the character encoding information.
public final java.lang.String getEncoding()
the encoding information stored in the <?xml ...?> tag or the user-defined output encoding if it has been more recently set.
Get the ID element hashtable in the XML DOM Tree
public java.util.Hashtable getIDHashtable()
Hashtable - associated with XMLDocument
The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.
public org.w3c.dom.DOMImplementation getImplementation()
The associated DOM implementation.
Get line number debug information
public int getLineNumber()
line the line number
Gets a code representing the type of the underlying object
public short getNodeType()
type of the node
The Document object associated with this node. Since this node is a Document this is null.
public org.w3c.dom.Document getOwnerDocument()
null
Retrieves the standalone information.
public final java.lang.String getStandalone()
the standalone attribute stored in the <?xml ...?> tag.
Get the system id of the entity contain this node
public java.lang.String getSystemId()
sysid the system id
Returns the non-marked-up text contained by this element.
public java.lang.String getText()
For text elements, this is the raw data. For elements with child nodes, this method traverses the entire subtree and appends the text for each terminal text element, effectively stripping out the XML markup for the subtree. For example, if the XML document contains the following: William Shakespeare
XMLDocument.getText returns "William Shakespeare".
Non-marked-up text contained by the element.
Retrieves the version information.
public final java.lang.String getVersion()
the version number stored in the <?xml ...?> tag.
Imports a node from another document to this document.
public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)
The returned node has no parent; (parentNode is null). The source nodeis not altered or removed from the original document; this method creates a new copy of the source node.For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's nodeName and nodeType, plus the attributes related to namespaces (prefix, localName, and namespaceURI). As in the cloneNode operation on a Node, the source node is not altered.
Node - to be imported ,boolean variable indicating whether the descendants of this node are to be imported
A copy of the importedNode which is attached to the current document but not a part of the document tree
DOMException - NOT_SUPPORTED_ERR: Raised if the type of the node being imported is not supported.
DOM 2
Inserts the node newChild before the existing child node refChild.
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
If refChild is null, insert newChild at the end of the list of children. If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.
newChild - The node to insert.
refChild - The reference node, i.e., the node before which the new node must be inserted.
The node being inserted.
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors. WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. NOT_FOUND_ERR: Raised if refChild is not a child of this node.
Writes the contents of this document to the given output stream.
public void print(java.io.OutputStream out)
out - OutputStream to write to
IOException - if an error occurs
Writes the contents of this document to the given output stream.
public void print(java.io.OutputStream out, java.lang.String enc)
out - OutputStream to write to
enc - Encoding to use for the output
IOException - if an invalid encoding was specified or if any other error occurs
Writes the contents of this document to the given output stream.
public void print(PrintDriver pd)
pd - PrintDriver used to write each node
IOException - if an error occurs
Writes the contents of this document to the given output stream.
public void print(java.io.PrintWriter out)
out - PrintWriter to write to
IOException - if an error occurs
Writes the contents of this document to the given output stream.
public void printExternalDTD(java.io.OutputStream out)
out - OutputStream to write to
IOException - if an error occurs
Writes the contents of the external DTD to the given output stream.
public void printExternalDTD(java.io.OutputStream out, java.lang.String enc)
out - OutputStream to write to
enc - Encoding to use for the output
IOException - if an invalid encoding was specified or if any other error occurs
Writes the contents of this document to the given output stream.
public void printExternalDTD(java.io.PrintWriter out)
out - PrintWriter to write to
IOException - if an error occurs
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
removes the elem from this documents list of child nodes
public org.w3c.dom.Node removeChild(org.w3c.dom.Node elem)
the - node to be removed
the node after its removed from the document
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this document is readonly. NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
If the newChild is already in the tree, it is first removed. This is an override of the XMLNode.removeChild method
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
The node replaced.
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node. WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than this one. NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
Report SAX Events from a DOM Tree
public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)
ContentHandler - cntHandler
SAXException - thrown by SAX Callback functions
Sets the doctype URI for the document
public void setDoctype(java.lang.String rootname, java.lang.String sysid, java.lang.String pubid)
root - The name of the root element
sysid - The system id of the doctype
pubid - The public id of the doctype (can be null)
Sets the character encoding for output. Eventually it sets the ENCODING stored in the <?xml ...?> tag, but not until the document is saved.
public final void setEncoding(java.lang.String encoding)
You should not call this method until the Document has been loaded.
encoding - The character encoding to set
Sets the locale for error reporting
public final void setLocale(java.util.Locale locale)
locale - Locale for error reporting.
public void setNodeContext(oracle.xml.util.NodeContext nctx)
Sets the doctype object by parsing sysid
public void setParsedDoctype(java.lang.String rootname, java.lang.String sysid, java.lang.String pubid)
root - The name of the root element
sysid - The system id of the doctype
pubid - The public id of the doctype (can be null)
Sets the standalone information stored in the <?xml ...?> tag.
public final void setStandalone(java.lang.String value)
value - The attribute value ('yes' or 'no').
Sets the version number stored in the <?xml ...?> tag.
public final void setVersion(java.lang.String version)
version - The version information to set.
Validates the content of a element node.
public boolean validateElementContent(org.w3c.dom.Element e)
e - Element to be validated
True if valid, else false
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 DOM DocumentFragment interface.
public class XMLDocumentFragment implements java.io.Serializable oracle.xml.parser.v2.XMLDocumentFragment
java.io.Serializable
Extends XMLElement rather than XMLNode so it can be handled as an element. This is convenient in processing
DocumentFragment,NodeFactory,DOMParser.setNodeFactory(NodeFactory)
Creates an empty document fragment
public XMLDocumentFragment()
Deprecated; use createElement(String) method of XMLDocument
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. For all normal XMLElement creation use createElement(String) of XMLDocument.
public org.w3c.dom.NamedNodeMap getAttributes()
An empty NamedNodeMap.
Gets a code representing the type of the underlying object
public short getNodeType()
type of the node
Gets the parent of this node
public org.w3c.dom.Node getParentNode()
The parent of this node (always null)
This class is used to throw DOM exceptions.
public class XMLDOMException oracle.xml.parser.v2.XMLDOMException
Constructs a XMLDOMException exception with a specified message and a code.
public XMLDOMException(short code)
code - Code indicated in DOM interface, uses default message
err - XMLError used for locale information
Constructs a XMLDOMException exception with a specified message and a code.
public XMLDOMException(short code, java.lang.String s)
code - Code indicated in DOM interface, uses default message
This class implements the DOMImplementation
public class XMLDOMImplementation implements java.io.Serializable oracle.xml.parser.v2.XMLDOMImplementation
java.io.Serializable
public XMLDOMImplementation()
Creates an XMLDocument object containing the specified DocumentType Node and a root element with the specified names and the empty DocumentType node.
public org.w3c.dom.Document createDocument(java.lang.String namespaceURI, java.lang.String qualifiedName, org.w3c.dom.DocumentType doctype)
namespaceURI - Namespace of the root element in the document.
qualifiedName - Qualified name of the root element in the document.
doctype - DocumentType (DTD) asscoiated with the document.
The Document object created.
INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character NAMESPACE_ERR: Raised if the qualifiedName is malformed,if the qualifiedName has a prefix and the namespaceURI is null or an empty String,or if the qualifiedName has a prefix that is "xml" and namespaceURI is different from "http://www.w3.org/XML/1998/namespace" WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document or was created from a different implementation.
Creates an empty DocumentType node with root element name, and system/public identifier.
public org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicId, java.lang.String systemId)
qualifiedName - Qualified name of the root element.
systemid - System identifier of the DocumentType node.
publicid - Public identifier of the DocumentType node.
the DocumentType object created.
DOMException - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character NAMESPACE_ERR: Raised if the qualifiedName is malformed.
Test if the DOM implementation implements a specific feature.
public boolean hasFeature(java.lang.String feature, java.lang.String version)
TRUE if the feature is implemented, FALSE alse otherwise
Sets a specified feature.
public void setFeature(java.lang.String feature)
feature - the DOM feature
DOMException - if the feature could not be set.
public class XMLElement implementsoracle.xml.parser.v2.NSName,oracle.xml.parser.v2.NSResolver, java.io.Externalizable oracle.xml.parser.v2.XMLElement
java.io.Externalizable,NSName, oracle.xml.util.NSName,NSResolver, java.io.Serializable
This class implements the DOM Element Interface
Default constructor.
public XMLElement()
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. For all normal XMLElement creation use createElement(String) of XMLDocument.
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
public org.w3c.dom.Node cloneNode(boolean deep)
The duplicate node has no parent ( parentNode returns null.). Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node.
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
The duplicate node.
Retrieves an attribute value by name.
public java.lang.String getAttribute(java.lang.String name)
name - The name of the attribute to retrieve.
The Attr value as a string, or the empty string if that attribute does not have a specified or default value.
Retrieves an Attr node by name.
public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
name - The name of the attribute to retrieve.
The Attr node with the specified attribute name or null if there is no such attribute.
public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
String - namespaceURI ,String localName of the attribute to be retrieved
Attribute with the given namespaceURI and localName if it exists, else null.
DOM 2 Retrieves an Attr node by local name and namespace URI.
public java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
namespaceURI - namespace of the attribute requested.
localName - local name of the attribute requested.
the value of the attribute with the above mentioned namespace URI and localName if it exists ,else null.
DOM 2 Retrieves an attribute value by local name and namespace URI.
A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
public org.w3c.dom.NamedNodeMap getAttributes()
The list of attributes of this element
Returns a NodeList of all immediate children with a given tag name,
public org.w3c.dom.NodeList getChildrenByTagName(java.lang.String name)
name - The name of the tag to match on.
A list of matching children
Returns a NodeList of all immediate children with a given tag name and namespace
public org.w3c.dom.NodeList getChildrenByTagName(java.lang.String name, java.lang.String ns)
name - The name of the tag to match on. (should be local name)
ns - The name space
A list of matching children
Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.
public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
tagname - The name of the tag to match on. The special value "*" matches all tags.
A new NodeList object containing all the matched Elements.
Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree.
public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
namespaceURI - the namespace of the element
localName - the local name of the element
DOM 2
Get the fully resolved name for this element.
public java.lang.String getExpandedName()
oracle.xml.util.NSName.getExpandedName() in interface oracle.xml.util.NSName
the fully resolved name
Retrieves the first Attr.
public XMLNode getFirstAttribute()
The first Attr node null if there is no attribute.
Gets the local Name for this element.
public java.lang.String getLocalName()
oracle.xml.util.NSName.getLocalName() in interface oracle.xml.util.NSName
the local Name
Gets the name space URI of this element
public java.lang.String getNamespaceURI()
the namespace URI of this element
DOM 2
Gets a code representing the type of the underlying object
public short getNodeType()
type of the node
Get the namespace prefix for this element.
public java.lang.String getPrefix()
oracle.xml.util.NSName.getPrefix() in interface oracle.xml.util.NSName
the namespace prefix
Get the qualified name for this element.
public java.lang.String getQualifiedName()
oracle.xml.util.NSName.getQualifiedName() in interface oracle.xml.util.NSName
the qualified name
Gets the name of the element.
public java.lang.String getTagName()
For example, in: <elementExample id="demo"> ... </elementExample> , tagName has the value "elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns the tagName of an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.
The element name
Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
public boolean hasAttribute(java.lang.String name)
String - name of the attribute whose presence is checked
true if the attribute whith the specified name is present, else null
DOM 2
Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value,false otherwise
public boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
namespaceURI - namespace of the attribute whose presence is checked
localName - local name of the attribute whose presence is checked
true when an attribute with a given local name and namespace URI is specified on this element or has a default value,false otherwise
DOM 2
Returns whether this node (if it is an element) has any attributes.
public boolean hasAttributes()
true if this node has any attributes, false otherwise.
DOM Level 2
Puts all Text nodes in the full depth of the sub-tree underneath this Element into a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are no adjacent Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular doc1ument tree structure are to be used.
public void normalize()
Deprecated as of DOM 2
XMLNode.normalize()
This method restores the information written by writeExternal by reading the input stream and regenerating the objects as per the information of the input stream.
public void readExternal(java.io.ObjectInput inArg)
java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable
inArg - is the ObjectInput stream used to read the compressed stream.
IOException - is thrown when there is an exception reading the compressed stream.
ClassNotFoundException - is thrown when the class is not found
Removes an attribute by name. If the removed attribute has a default value it is immediately replaced.
public void removeAttribute(java.lang.String name)
name - The name of the attribute to remove.
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
Removes the specified attribute.
public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)
oldAttr - The Attr node to remove from the attribute list. If the removed Attr has a default value it is immediately replaced.
The Attr node that was removed.
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. NOT_FOUND_ERR: Raised if oldAttr is not an attribute of the element.
Removes an attribute by local name and namespace URI.
public void removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
namespaceURI - namespace of the attribute to be removed
localName - local name of the attribute to be removed
DOMEXception - NO_MODIFICATIONS_ALLOWED_ERR : if this element is readonly
DOM 2
Report SAX Events from a DOM Tree
public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)
ContentHandler - cntHandler
SAXException - thrown by SAX Callback functions
Given a namespace prefix, find the namespace definition in scope in this element.
public java.lang.String resolveNamespacePrefix(java.lang.String prefix)
NSResolver.resolveNamespacePrefix(String) in interface NSResolver
prefix - Namespace prefix to be resolved if the prefix == #default, return the default namespace
the resolved Namespace (null, if prefix could not be resolved)
Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter.
public void setAttribute(java.lang.String name, java.lang.String value)
This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute. This method is namespace unaware and hence wont result in update of namespace table if a new attr is added thru this method
name - The name of the attribute to create or alter.
value - Value to set in string form.
DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one.
public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
newAttr - The Attr node to add to the attribute list.
If the newAttr attribute replaces an existing attribute with the same name, the previously existing Attr node is returned, otherwise null is returned.
DOMException - WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one.
public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)
Attribute - node to be added
the Attribute Node added
DOMException - WRONG_DOCUMENT_ERR : raised if the newAttr was created from a document different from the one that created the document NO_MODIFICATIONS_ALLOWED_ERR :Raised if this element is readonly INUSE_ATTRIBUTE_ERR : Raised if newAttr is already an attribute of another Element object
DOM 2
Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the qualifiedName, and its value is changed to be the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out.
public void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)
namespaceURI - namespace of the attribute to be added
localName - local name of the attribute to be added
value - value of the attribute to be added
DOMException - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains illegal Characters NAMESPACE_ERR : Raised if the qualified name is malformed ,if the qualified name has a prefix and the namespace URI is null or an empty string,or if the qulaifiedName is "xmlns" and namespace URI is different from "http://www.w3.org/2000/xmlns/" ,or if qualifiedName has a prefix that is "xml" and the namespaceURI is different from http://www.w3.org/XML/1998/namespaces NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
DOM 2
Validates the content of a element node.
public boolean validateContent(DTD dtd)
dtd - The DTD object used to validate the element.
schema - The XMLSchema object used to validate the element.
True if valid, else false
Validates the content of the element against given XML Schema param schema - schema used to validate
public boolean validateContent(oracle.xml.parser.schema.XMLSchema schema)
True if valid, else false
Validates the content of the element against given XML Schema in the given mode.
public boolean validateContent(oracle.xml.parser.schema.XMLSchema schema, java.lang.String mode)
schem - - schema used to validate the content
mode - - the validation mode
True if valid, else false
This method saves the state of the object by creating a binray compressed stream with information about this object.
public void writeExternal(java.io.ObjectOutput outArg)
outArg: The ObjectOutput stream used to write the serialized/compressed stream.
java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable
cxmlContext - The context of the output compressed stream
This class implements the DOM Entity interface and represens an XML internal or external entity as defined in the XML Document Type Definition (DTD).
public class XMLEntity implements java.io.Externalizable oracle.xml.parser.v2.XMLEntity
java.io.Externalizable, java.io.Serializable
Default constructor.
public XMLEntity()
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.
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
public org.w3c.dom.Node cloneNode(boolean deep)
The duplicate node has no parent ( parentNode returns null.). Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node.
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
The duplicate node.
Gets a code representing the type of the underlying object
public short getNodeType()
type of the node
Gets the value of this node, depending on its type
public java.lang.String getNodeValue()
Value of this node
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
For unparsed entities, gets the name of the notation for the entity. For parsed entities, this is null.
public java.lang.String getNotationName()
The notation name
Gets the public identifier associated with the entity, if specified. If the public identifier was not specified, this is null.
public java.lang.String getPublicId()
The public identifier
Gets the system identifier associated with the entity, if specified. If the system identifier was not specified, this is null.
public java.lang.String getSystemId()
The system identifier
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.
Sets the value of entity.
public void setNodeValue(java.lang.String arg)
arg - The new value of the entity.
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 DOM EntityReference interface.
public class XMLEntityReference implements java.lang.Cloneable, java.io.Externalizable oracle.xml.parser.v2.XMLEntityReference
java.lang.Cloneable, java.io.Externalizable, java.io.Serializable
Default constructor.
public XMLEntityReference()
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.
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
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 - is the ObjectOutput stream used to write the compressed stream.
IOException - is thrown when there is an exception while writing the compressed stream.
This class hold error message and the line number where it occured
public class XMLError extends oracle.xml.util.XMLError oracle.xml.util.XMLError | +--oracle.xml.parser.v2.XMLError
Default constructor
public XMLError()
Adds a new error to the vector
public void error(int line, int col, java.lang.String pubId, java.lang.String sysId, java.lang.String mesg, int id, int type, boolean stop)
line - the line number where error occurs
col - the column number where the error occurs
pubId - the public Identifier
sysId - the system identifier
mesg - the error message
id - the error id
type - the error type
stop - boolean to indicate if the processing needs to be stopped.
throws - ParseException in case of a fatal error
Flush all the error to the error listener
public void flushErrorListener(oracle.xml.parser.v2.DOMLocator locator)
locator - the DOM Locator object
Flush all the error to the error listener
public void flushErrorListenerStream(oracle.xml.parser.v2.DOMLocator locator)
locator - the DOM Locator object
Flush all the error to the ouput stream output stream defaults or to error handler
public void flushErrors()
throws - ParseException in case of a fatal error
Return register error handler
public org.xml.sax.ErrorHandler getErrorHandler()
ErrorHandler
Return register error listener
public javax.xml.transform.ErrorListener getErrorListener()
ErrorListener
Register error handler
public void setErrorHandle