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 o
bject
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(NSName
elem,SAXAttrList
attrlist)
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(NSName
elem,SAXAttrList
attrlist)
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.XMLPI
implements 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 Element
s 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 Element
s.
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 Element
s 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 Element
s.
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 setErrorHandler(org.xml.sax.ErrorHandler err)
err
- - ErrorHandler
Register error listener
public void setErrorListener(javax.xml.transform.ErrorListener el)
err
- - ErrorListener
Implements the DOM Node
interface and serves as the primary datatype for the entire Document Object Model. It represents a single node in the document tree.
public abstract class XMLNode implements java.lang.Cloneable, java.io.Externalizable oracle.xml.parser.v2.XMLNode
XMLNSNode
java.lang.Cloneable, java.io.Externalizable, java.io.Serializable
The attributes nodeName, nodeValue and attributes are included as a mechanism to get at node information without casting down to the specific derived instance. In cases where there is no obvious mapping of these attributes for a specific nodeType (e.g., nodeValue for an Element or attributes for a Comment), this returns null. Note that the derived classes may contain additional and more convenient mechanisms to get and set the relevant information. This DOM Nodes extending XMLNode instead of XMLNSNode have fixed Nodename defined by DOM specification. Also only node that cannot have child nodes extend this class.
Constructs a new XMLNode
having the given name and type
protected XMLNode()
tag
- Name of the node
This method allows the registration of event listeners on the event target (node).
public void addEventListener(java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)
DOMEvents
type
- Type of event for which the listener is registered
listener
- The listener object
useCapture
- flag to indicate if the listener wants to initiate capture
Adds the node newChild
to the end of the list of children of this node. If the newChild
is already in the tree, it is first removed.
public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
newChild
- The node to add.If it is a DocumentFragment
object, the entire contents of the document fragment are moved into the child list of this node
The node added.
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 append 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.
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
This method allows the dispatch of events into the implementations event model
public boolean dispatchEvent(org.w3c.dom.events.Event evt)
boolean value that indicates whether preventDefault or stopPropogation was called
UNSPECIFIED_EVENT_TYPE:
- Raised if the Event's type was not specified by initializing the event before dispatchEvent was called.
Gets a NamedNodeMap
containing the attributes of this node (if it is an Element
) or null
otherwise.
public org.w3c.dom.NamedNodeMap getAttributes()
the attributes of this node
Gets a NodeList
that contains all children of this node. If there are no children, this is a NodeList
containing no nodes.
public org.w3c.dom.NodeList getChildNodes()
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.
The children of this node
Get column number debug information
public int getColumnNumber()
column the column number
Get debug information mode
public boolean getDebugMode()
flag debugging mode
Gets the first child of this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getFirstChild()
The first child of this node
Gets the last child of this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getLastChild()
The last child of this node
Get line number debug information
public int getLineNumber()
line the line number
Gets the Local Name of this node overrided by node types for which namespace is meaningful.
public java.lang.String getLocalName()
DOM 2
Gets the namespace URI of this node. overrided by node types for which namespace is meaningful.
public java.lang.String getNamespaceURI()
the namespace
DOM 2
Gets The node immediately following this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getNextSibling()
The next node
Gets the name of the node
public java.lang.String getNodeName()
name of the node
Gets the type of the node
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 Document
object associated with this node. This is also the Document
object used to create new nodes. When this node is a Document
this is null
.
public org.w3c.dom.Document getOwnerDocument()
The document associated with this node
Gets the parent of this node. 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
.
public org.w3c.dom.Node getParentNode()
The parent of this node
Gets the prefix of this node overrided by node types for which namespace is meaningful.
public java.lang.String getPrefix()
the prefix
DOM 2
Gets the node immediately preceding this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getPreviousSibling()
the previous node
Get a property of the node
public java.lang.Object getProperty(java.lang.String propName)
propName
- - Name of the property
Object propValue - Value of the property
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. 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.
public java.lang.String getText()
For example, if the XML document contains the following: William Shakespeare
XMLDocument.getText
returns "William Shakespeare".
Non-marked-up text contained by the element
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
This is a convenience method to allow easy determination of whether a node has any children.
public boolean hasChildNodes()
true
if the node has any children, false
if the node has no children.
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.
Returns the node flag information
public boolean isNodeFlag(int flag)
true if the flag is set
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
public boolean isSupported(java.lang.String feature, java.lang.String version)
String
- feature ,String version
true,if the feature is supported else false
Writes the contents of this node 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 node 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 node using the given print writer.
public void print(java.io.PrintWriter out)
out
- PrintWriter
to use
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 child node indicated by oldChild
from the list of children, and returns it.
public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
oldChild
- The node being removed.
The node removed.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. NOT_FOUND_ERR: Raised if oldChild
is not a child of this node.
This method allows the removal of event listeners from the event target (node).
public void removeEventListener(java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)
type
- Type of event for which the listener is registered
listener
- The listener object
useCapture
- flag to indicate if the listener wants to initiate capture
Replaces the child node oldChild
with newChild
in the list of children, and returns the oldChild
node. If the newChild
is already in the tree, it is first removed.
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
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, or it the node to put in 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 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
Resets the node flag information
public void resetNodeFlag(int flag)
flag
- the node flag
Selects nodes from the tree which match the given pattern. This method assumes that the pattern does not contain namespace prefixes.
public org.w3c.dom.NodeList selectNodes(java.lang.String pattern)
pattern
- XSL pattern to match
a list of matching nodes
XSLException
- Raised if there is an error while doing the match
Selects nodes from the tree which match the given pattern
public org.w3c.dom.NodeList selectNodes(java.lang.String pattern, NSResolver
nsr)
pattern
- XSL pattern to match
nsr
- NSResolver to resolve any namespace prefixes that occur in the given pattern
a list of matching nodes
XSLException
- Raised if there is an error while doing the match
Selects the first node from the tree that matches the given pattern
public org.w3c.dom.Node selectSingleNode(java.lang.String pattern)
pattern
- XSL pattern to match
matching node
XSLException
- Raised if there is an error while doing the match
Selects the first node from the tree that matches the given pattern
public org.w3c.dom.Node selectSingleNode(java.lang.String pattern, NSResolver
nsr)
pattern
- XSL pattern to match
nsr
- NSResolver to resolve any prefixes that occur in given pattern
matching node
XSLException
- Raised if there is an error while doing the match
Set debug information in the node
public void setDebugInfo(int line, int col, java.lang.String sysid)
line
- the line number
col
- the col number
sysid
- the system id
Sets the node flag information
public void setNodeFlag(int flag)
flag
- the node flag
Sets the value of this node, depending on its type
public void setNodeValue(java.lang.String nodeValue)
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 prefix of this node overrided by node types for which namespace is meaningful.
public void setPrefix(java.lang.String prefix)
prefix
- set the prefix
DOMException
- if any DOM Exception occurs
DOM 2
Set a property of the node
public void setProperty(java.lang.String propName, java.lang.Object propValue)
propName
- - Name of the property
propValue
- - Value of the property
public boolean supports(java.lang.String feature, java.lang.String version)
Deprecated; use isSupported instead
String
- feature ,String version
true,if the feature is supported else false
DOM 2 Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
Transforms a node in the tree using the given stylesheet
public org.w3c.dom.DocumentFragment transformNode(XSLStylesheet
xsl)
xsl
- XSLStylesheet
to be used for transformation
a document fragment
XSLException
- Raised if there is an error while doing the XSL transformation.
Selects the value of the first node from tree that matches the pattern
public java.lang.String valueOf(java.lang.String pattern)
pattern
- XSL pattern to match
value of the matching node
XSLException
- Raised if there is an error while doing the match
Selects the value of the first node from tree that matches the pattern
public java.lang.String valueOf(java.lang.String pattern, NSResolver
nsr)
pattern
- XSL pattern to match
nsr
- NSResolver to resolve any prefixes that occur in given pattern
value of the matching node
XSLException
- Raised if there is an error while doing the match
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 out)
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 implements the DOM Notation
interface and represents a notation declared in the Document Type Definition.
public class XMLNotation implements java.io.Externalizable oracle.xml.parser.v2.XMLNotation
java.io.Externalizable, java.io.Serializable
Default constructor
public XMLNotation()
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 XMLNotation(String)
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 name of the Notation
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
Gets the Public identifer; if not specified, then null
public java.lang.String getPublicId()
The public identifier
Gets the System identifer; if not specified, then 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
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.
Sets the Public Identifier
public void setPublicId(java.lang.String pubid)
pubid
- Public Identifier to set
Sets the System Identifier
public void setSystemId(java.lang.String url)
url
- System Identifier to set
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.
public class XMLNSNode extendsoracle.xml.parser.v2.XMLNode
oracle.xml.parser.v2.XMLNode
| +--oracle.xml.parser.v2.XMLNSNode
java.lang.Cloneable, java.io.Externalizable, java.io.Serializable
Extends XMLNode to add support for Namespace names and children
Constructs a new XMLNSNode
having the given name and type
protected XMLNSNode(java.lang.String tag)
tag
- Name of the node
Adds text to this node, or appends str to the last child if the last child is a text node.
public void addText(char[] ch, int start, int length)
ch
- char array to add
start
- start index in the char array
length
- no of chars to be added
XMLDOMException
- if text can't be added to this node
Adds text to this node, or appends str to the last child if the last child is a text node.
public XMLNode
addText(java.lang.String str)
str
- text to add
XMLDOMException
- if text can't be added to this node
Adds the node newChild
to the end of the list of children of this node. If the newChild
is already in the tree, it is first removed.
public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChildArg)
XMLNode.appendChild(Node)
in class XMLNode
newChild
- The node to add.If it is a DocumentFragment
object, the entire contents of the document fragment are moved into the child list of this node
The node added.
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 append 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.
Gets 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()
XMLNode.getChildNodes()
in class XMLNode
The children of this node
Gets the first child of this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getFirstChild()
XMLNode.getFirstChild()
in class XMLNode
The first child of this node
Gets the last child of this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getLastChild()
XMLNode.getLastChild()
in class XMLNode
The last child of this node
Gets the Local Name of this node overrided by node types for which namespace is meaningful.
public java.lang.String getLocalName()
XMLNode.getLocalName()
in class XMLNode
localname of the node
DOM 2
Gets the namespace URI of this node. overrided by node types for which namespace is meaningful.
public java.lang.String getNamespaceURI()
XMLNode.getNamespaceURI()
in class XMLNode
namespace of the node
DOM 2
Gets the name of this node, depending on its type
public java.lang.String getNodeName()
XMLNode.getNodeName()
in class XMLNode
Name of this node
Gets the prefix of this node overrided by node types for which namespace is meaningful.
public java.lang.String getPrefix()
XMLNode.getPrefix()
in class XMLNode
prefix of the node
DOM 2
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".
XMLNode.getText()
in class XMLNode
non-marked-up text contained bu this element
This is a convenience method to allow easy determination of whether a node has any children.
public boolean hasChildNodes()
XMLNode.hasChildNodes()
in class XMLNode
true
if the node has any children, false
if the node has no children.
Inserts the node newChild
before the existing child node refChild
.
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChildArg, org.w3c.dom.Node refChildArg)
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.
XMLNode.insertBefore(Node, Node)
in class XMLNode
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.
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes,i.e., there are neither adjacent Text nodes nor empty Text nodes.
public void normalize()
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 particulardocument tree structure are to be used.
XMLNode.normalize()
in class XMLNode
DOM 2
Removes the child node indicated by oldChild
from the list of children, and returns it.
public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChildArg)
XMLNode.removeChild(Node)
in class XMLNode
oldChild
- The node being removed.
The node removed.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node 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. If the newChild
is already in the tree, it is first removed.
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChildArg, org.w3c.dom.Node oldChildArg)
XMLNode.replaceChild(Node, Node)
in class XMLNode
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, or it the node to put in 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 oldChild
is not a child of this node.
Sets the prefix of this node overrided by node types for which namespace is meaningful.
public void setPrefix(java.lang.String prefix)
XMLNode.setPrefix(String)
in class XMLNode
prefix
- Sets the prefix of the node
DOM 2
XMLOutputSteam -- writes output stream, can handle XML encoding
public class XMLOutputStream extends java.lang.Object java.lang.Object | +--oracle.xml.parser.v2.XMLOutputStream
Field | Syntax | Description |
---|---|---|
COMPACT |
public static int COMPACT |
|
DEFAULT |
public static int DEFAULT |
|
PRETTY |
public static int PRETTY |
Builds the ASCII output stream
public XMLOutputStream(java.io.OutputStream out)
out
- the output stream
Builds the output stream from PrintWriter
public XMLOutputStream(java.io.PrintWriter out)
out
- the PrintWriter stream
Set indenting level for output
public void addIndent(int offset)
offset
- the indenting level
Closes the output stream
public void close()
IOException
- if there is any error in closing the output stream
Flushes the output stream
public void flush()
IOException
- if there is any error in flushing the output stream
Gets the Current output style
public int getOutputStyle()
Sets the output character encoding
public void setEncoding(java.lang.String encoding, boolean lendian, boolean byteOrderMark)
encoding
- the encoding of the stream
lendian
- flag to indicate if the encoding is of type little endian
byteOrderMark
- flag to indicate if byte order mark is set
IOException
- if error is thrown in setting the encoding type
Sets the Output the style
public void setOutputStyle(int style)
style
- the output style
Outputs character according to type of the output stream
public void write(int c)
c
- the character that needs to be written
IOException
- if there is any error in writing the character
Write string to the output
public void writeChars(java.lang.String str)
str
- the string that is written to the output stream
IOException
- error thrown if there is any error in writing the string
Output the indentation
public void writeIndent()
IOException
- error thrown if there is any error in writing the string
Newline writer
public void writeNewLine()
IOException
- error thrown if there is any error in writing the string
Write string with surrounding quotes
public void writeQuotedString(java.lang.String str)
str
- the string that is written to the output stream
IOException
- error thrown if there is any error in writing the string
Indicates that a parsing exception occurred while processing an XML document
public class XMLParseException oracle.xml.parser.v2.XMLParseException
public XMLParseException(java.lang.String mesg, java.lang.String pubId, java.lang.String sysId, int line, int col, int type)
Get the error message at specified index
public java.lang.String formatErrorMessage(int i)
The error message
Get the column number of error at specified index
public int getColumnNumber(int i)
The column number
Get the exception (if exists) that occured in error at specified index
public java.lang.Exception getException(int i)
The exception
Get the line number of error at specified index
public int getLineNumber(int i)
The line number
Get the error message at specified index
public java.lang.String getMessage(int i)
The error message
Get the type of the error message at specified index
public int getMessageType(int i)
The error message type
Return the total number of errors/warnings found during parsing
public int getNumMessages()
The number of errors/warnings
Get the public ID of input when error at specified index occured
public java.lang.String getPublicId(int i)
The public ID
Get the system ID of input when error at specified index occured
public java.lang.String getSystemId(int i)
The system ID
This class serves as a base class for the DOMParser
and SAXParser
classes. It contains methods to parse eXtensible Markup Language (XML) 1.0 documents according to the World Wide Web Consortium (W3C) recommendation. This class can not be instantiated (applications may use the DOM or SAX parser depending on their requirements).
public abstract class XMLParser oracle.xml.parser.v2.XMLParser
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.
Gets the base URL
public java.net.URL getBaseURL()
the base URL
Return the current entity resolver.
public org.xml.sax.EntityResolver getEntityResolver()
The current entity resolver, or null if none has been registered.
SAX 2.0
setEntityResolver(EntityResolver)
Return the current error handler.
public org.xml.sax.ErrorHandler getErrorHandler()
The current error handler, or null if none has been registered.
SAX 2.0
setErrorHandler(ErrorHandler)
Returns the release version of the Oracle XML Parser
public static java.lang.String getReleaseVersion()
the release version string
Returns the validation mode
public int getValidationModeValue()
0
if the XML parser is NONVALIDATING 1
if the XML parser is PARTIAL_VALIDATION 2
if the XML parser is DTD_VALIDATION 3
if the XML parser is SCHEMA_VALIDATION
Get a property. The property is returned if present and supported, else null is returned
public java.lang.Object getXMLProperty(java.lang.String name)
name
- - name of the property
Object - value of the property
Check is the property is read-only Returns true if the property is not supported
public boolean isXMLPropertyReadOnly(java.lang.String name)
name
- - name of the property
boolean - TRUE is read-only
Check is the property is supported
public boolean isXMLPropertySupported(java.lang.String name)
name
- - name of the property
boolean - TRUE is supported
Parses the XML from given input source
public void parse(org.xml.sax.InputSource in)
in
- the org.xml.sax.InputSouce
to parse
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
Parses the XML from given input stream. The base URL should be set for resolving external entities and DTD.
public final void parse(java.io.InputStream in)
in
- the InputStream
containing XML data to parse.
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
setBaseURL(URL)
Parses the XML from given input stream. The base URL should be set for resolving external entities and DTD.
public final void parse(java.io.Reader r)
r
- the Reader
containing XML data to parse.
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
setBaseURL(URL)
Parses the XML from the URL indicated
public void parse(java.lang.String in)
in
- the String
containing the URL to parse from
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
Parses the XML document pointed to by the given URL and creates the corresponding XML document hierarchy.
public final void parse(java.net.URL url)
url
- the url points to the XML document to parse.
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()
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.
Set the base URL for loading external enitites and DTDs. This method should to be called if the parse(InputStream) is used to parse the XML Document
public void setBaseURL(java.net.URL url)
url
- The base URL
Set the DTD
public void setDoctype(DTD
dtd)
dtd
- DTD
to set and used while parsing
Allow an application to register an entity resolver.
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
If the application does not register an entity resolver, the XMLReader will perform its own default resolution.
Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.
resolver
- The entity resolver.
java.lang.NullPointerException
- If the resolver argument is null.
getEntityResolver()
Allow an application to register an error event handler.
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.
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 error handler.
java.lang.NullPointerException
- If the handler argument is null.
getErrorHandler()
Applications can use this to set the locale for error reporting.
public void setLocale(java.util.Locale locale)
locale
- Locale
to set
SAXException
- A SAXException
could be thrown.
org.xml.sax.Parser
Set the white space preserving mode
public void setPreserveWhitespace(boolean flag)
flag
- preserving mode
Set the validation mode
public void setValidationMode(int valMode)
This method sets the validation mode of the parser to one of the 4 types: NONVALIDATING, PARTIAL_VALIDATION, DTD_VALIDATION and SCHEMA_VALIDATION.
valMode
- determines the type of the validation mode which the parser is set to
Set a property
public java.lang.Object setXMLProperty(java.lang.String name, java.lang.Object value)
The value of the property set is returned if successfully set, a null is returned if the property is read-only and cannot be set or is not supported.
name
- - name of the property
value
- - value of the property
Object - the set property
Set an XMLSchema for validating the instance document
public void setXMLSchema(java.lang.Object schema)
schema
- The XMLSchema object
This class implements the DOM Processing Instruction interface.
public class XMLPI implements java.io.Externalizable oracle.xml.parser.v2.XMLPI
XMLDeclPI
java.io.Externalizable, java.io.Serializable
ProcessingInstruction
,NodeFactory
,DOMParser.setNodeFactory(NodeFactory)
Default constructor.
public XMLPI()
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 text string to the node
public XMLNode
addText(java.lang.String str)
str
- the text string to be added
the node
Gets the name of the PI
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 target of this PI. XML defines this as the first token following markup that begins the processing instruction.
public java.lang.String getTarget()
The target of the PI.
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
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
out
- is the ObjectOutput stream used to write the compressed stream.
IOException
- is thrown when there is an exception while writing the compressed stream.
The XMLPrintDriver
implements PrintDriver
interface.
public class XMLPrintDriver extends java.lang.Object implements
oracle.xml.parser.v2.PrintDriver
java.lang.Object
|
+--oracle.xml.parser.v2.XMLPrintDriver
PrintDriver
Field | Syntax | Description |
---|---|---|
|
|
public XMLPrintDriver(java.io.OutputStream os)
public XMLPrintDriver(java.io.PrintWriter pw)
Closes the output stream or print writer
public void close()
PrintDriver.close()
in interface PrintDriver
Flushes the output stream or print writer
public void flush()
PrintDriver.flush()
in interface PrintDriver
Prints a XMLAttr
node
public void printAttribute(XMLAttr
attr)
PrintDriver.printAttribute(XMLAttr)
in interface PrintDriver
attr
- The XMLAttr node.
Calls print method for each attribute of the XMLElement
public final void printAttributeNodes(XMLElement
elem)
PrintDriver.printAttributeNodes(XMLElement)
in interface PrintDriver
elem
- The elem whose attributes are to be printed.
Prints a XMLCDATA
node
public void printCDATASection(XMLCDATA
cdata)
PrintDriver.printCDATASection(XMLCDATA)
in interface PrintDriver
cdata
- The XMLCDATA node.
Calls print method for each child of the XMLNode
public final void printChildNodes(XMLNode
node)
PrintDriver.printChildNodes(XMLNode)
in interface PrintDriver
node
- The node whose children are to be printed.
Prints a XMLComment
node
public void printComment(XMLComment
comment)
PrintDriver.printComment(XMLComment)
in interface PrintDriver
comment
- The comment node.
Prints an DTD
.
public void printDoctype(DTD
dtd)
PrintDriver.printDoctype(DTD)
in interface PrintDriver
dtd
- The dtd to be printed.
Prints an XMLDocument
.
public void printDocument(XMLDocument
doc)
PrintDriver.printDocument(XMLDocument)
in interface PrintDriver
elem
- The document to be printed.
Prints an empty XMLDocumentFragment
object.
public void printDocumentFragment(XMLDocumentFragment
dfrag)
PrintDriver.printDocumentFragment(XMLDocumentFragment)
in interface PrintDriver
dfrag
- The document fragment to be printed.
Prints an XMLElement
.
public void printElement(XMLElement
elem)
PrintDriver.printElement(XMLElement)
in interface PrintDriver
elem
- The element to be printed.
Prints a XMLEntityReference
node
public void printEntityReference(XMLEntityReference
en)
PrintDriver.printEntityReference(XMLEntityReference)
in interface PrintDriver
en
- The XMLEntityReference node.
Prints a XMLPI
node
public void printProcessingInstruction(XMLPI
pi)
PrintDriver.printProcessingInstruction(XMLPI)
in interface PrintDriver
pi
- The XMLPI node.
Prints a XMLText
node
public void printTextNode(XMLText
text)
PrintDriver.printTextNode(XMLText)
in interface PrintDriver
text
- The text node.
Sets the encoding of the print driver.
public void setEncoding(java.lang.String enc)
PrintDriver.setEncoding(String)
in interface PrintDriver
enc
- The encoding of the document being printed.
This class customizes the RangeException
public class XMLRangeException oracle.xml.parser.v2.XMLRangeException
public XMLRangeException(short code)
This class implements the DOM Text interface.
public class XMLText implements java.io.Serializable, java.io.Externalizable oracle.xml.parser.v2.XMLText
java.io.Externalizable, java.io.Serializable
Text
,NodeFactory
,DOMParser.setNodeFactory(NodeFactory)
Default constructor.
public XMLText()
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 text to the data of the text node, similar to appendData
public void addText(char[] ch, int start, int length)
ch
- char array to be appended
start
- start index
length
- length of the char array
The character data of the node that implements this interface.
public java.lang.String getData()
The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a Text
node. However, implementation limits may mean that the entirety of a node's data may not fit into a single DOMString
. In such cases, the user may call substringData
to retrieve the data in appropriately sized pieces.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
DOMException
- DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString
variable on the implementation platform.
Gets the name of the XMLText
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
Gets a value of this text node
public java.lang.String getNodeValue()
String value of the node
DOMException
- in any error occurs when retrieving the value
Check is the text node is a whitespace node
public boolean isWhiteSpaceNode()
boolean
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)
This method is called if XMLText object is deserialized (or read) as an independent node and not called from some other DOM node.
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
Report SAX Events from a DOM Tree
public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)
ContentHandler
- cntHandler
SAXException
- thrown by SAX Callback functions
Breaks Text
node into two Text nodes at specified offset, so they are both siblings, and the node only contains content up to the offset. New node inserted as next sibling contains all content at and after the offset point.
public org.w3c.dom.Text splitText(int offset)
offset
- Offset at which to split, starting from 0
New Text
node
DOMException
- INDEX_SIZE_ERR: Raised if specified offset is negative or greater than number of characters in data
. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
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
out
- The ObjectOutput stream used to write the compressed stream.
IOException
- is thrown when there is an exception while writing the compressed stream.
Basic interface for XMLToken
public interface XMLToken
All XMLParser applications with Tokenizer feature must implement this interface. The interface has to be registered using XMLParser
method setTokenHandler(XMLToken handler)
.
If XMLtoken handler != null then for each registered and found token the parser calls the XMLToken call-back method token(int token, String value)
. During tokenizing the parser doesn't validate the document and doesn't include/read internal/external entities. If XMLtoken handler == null then the parser parses as usual.
A request for XML token is registered (on/off) using XMLParser method setToken (int token, boolean set)
. The requests could be registered during the parsing (from inside the call-back method) as well.
The XML tokens are defined as public constants in XMLToken
interface. They correspond to the XML syntax variables from W3C XML Syntax Specification.
The interface call-back method. Receives an XML token and it's corresponding value
public void token(int token, java.lang.String value)
token
- The XML token constant as specified in the interface.
value
- The corresponding substring from the parsed text.
This class implements an eXtensible Markup Language (XML) 1.0 parser according to the World Wide Web Consortium (W3C) recommendation.
public class XMLTokenizer oracle.xml.parser.v2.XMLTokenizer
Creates a new Tokenizer object.
public XMLTokenizer()
Creates a new Tokenizer object.
public XMLTokenizer(XMLToken
handler)
Document ::= Prolog Element Misc*
public void parseDocument()
Applications can use this to register a new error event handler. This replaces any previous setting for error handling.
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
handler
- ErrorHandler
being registered
Register a output stream for errors
public void setErrorStream(java.io.OutputStream out)
Applications can use this to register a new token for XML tokenizer.
public void setToken(int token, boolean val)
token
- XMLToken
being set
Applications can use this to register a new XML tokenizer event handler.
public void setTokenHandler(XMLToken
handler)
handler
- XMLToken
being registered
Tokenizes the XML from given input source
public final void tokenize(org.xml.sax.InputSource in)
in
- the org.xml.sax.InputSouce
to parse
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
Tokenizes the XML from given input stream.
public final void tokenize(java.io.InputStream in)
in
- the InputStream
containing XML data to parse.
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
XMLParser.setBaseURL(URL)
Tokenizes the XML from given input stream.
public final void tokenize(java.io.Reader r)
r
- the Reader
containing XML data to parse.
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
XMLParser.setBaseURL(URL)
Tokenizes the XML from the URL indicated
public final void tokenize(java.lang.String in)
in
- the String
containing the URL to parse from
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
Tokenizes the XML document pointed to by the given URL and creates the corresponding XML document hierarchy.
public final void tokenize(java.net.URL url)
url
- the url points to the XML document to parse.
XMLParseException
- if syntax or other error encountered.
SAXException
- Any SAX exception, possibly wrapping another exception.
IOException
- IO Error.
Defines the API to obtain DOM Document instances from an XML document. Using this class, an application programmer can obtain a org.w3c.dom.Document
from XML.
public class JXDocumentBuilder oracle.xml.jaxp.JXDocumentBuilder
An instance of this class can be obtained from the DocumentBuilderFactory.newDocumentBuilder
method. Once an instance of this class is obtained, XML can be parsed from a variety of input sources. These input sources are InputStreams, Files, URLs, and SAX InputSources.
Note that this class reuses several classes from the SAX API. This does not require that the implementor of the underlying DOM implmenetation use a SAX parser to parse XML document into a Document
. It merely requires that the implementation communicate with the application using these existing APIs.
JAXP 1.0
The DOMImplementation
object that handles this document. A DOM application may use objects from multiple implementations.
public org.w3c.dom.DOMImplementation getDOMImplementation()
The associated DOM implementation.
Indicates whether or not this parser is configured to understand namespaces.
public boolean isNamespaceAware()
Indicates whether or not this parser is configured to validate XML documents.
public boolean isValidating()
Obtain a new instance of a DOM Document object to build a DOM tree with.
public org.w3c.dom.Document newDocument()
Parse the content of the given input source as an XML document and return a new DOM Document object.
public org.w3c.dom.Document parse(org.xml.sax.InputSource is)
is
- InputSource containing the content to be parsed.
IOException
- If any IO errors occur.
SAXException
- If any parse errors occur.
IllegalArgumentException
- If the InputSource is null
org.xml.sax.DocumentHandler
Specify the EntityResolver
to be used to resolve entities present in the XML document to be parsed. Setting this to null
will result in the underlying implementation using it's own default implementation and behavior.
public void setEntityResolver(org.xml.sax.EntityResolver er)
Specify the ErrorHandler
to be used to resolve entities present in the XML document to be parsed. Setting this to null
will result in the underlying implementation using it's own default implementation and behavior.
public void setErrorHandler(org.xml.sax.ErrorHandler eh)
Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents.
public class JXDocumentBuilderFactory oracle.xml.jaxp.JXDocumentBuilderFactory
JAXP 1.0
Default Constructor
public JXDocumentBuilderFactory()
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.
Indicates whether or not the factory is configured to produce parsers which expand entity reference nodes. Always return TRUE - Currently there is no way to prevent entity references expansions
public boolean isExpandEntityReferences()
boolean
Indicates whether or not the factory is configured to produce parsers which ignores comments. Always returns false - currently ignoring comments is not configurable
public boolean isIgnoringComments()
boolean
Indicates whether or not the factory is configured to produce parsers which are namespace aware. Always returns TRUE - Currently there is no way to turn of Namespaces
public boolean isNamespaceAware()
boolean namespace awareness.
Creates a new instance of a DocumentBuilder using the currently configured parameters.
public javax.xml.parsers.DocumentBuilder newDocumentBuilder()
ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies the configuration requested
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.
Defines the API that wraps an org.xml.sax.XMLReader
implementation class. In JAXP 1.0, this class wrapped the org.xml.sax.Parser
interface, however this interface was replaced by the XMLReader
.
public class JXSAXParser oracle.xml.jaxp.JXSAXParser
For ease of transition, this class continues to support the same name and interface as well as supporting new methods. An instance of this class can be obtained from the SAXParserFactory.newSAXParser
method. Once an instance of this class is obtained, XML can be parsed from a variety of input sources. These input sources are InputStreams, Files, URLs, and SAX InputSources.
This static method creates a new factory instance based on a system property setting or uses the platform default if no property has been defined.
The system property that controls which Factory implementation to create is named "javax.xml.style.TransformFactory". This property names a class that is a concrete subclass of this abstract class. If no property is defined, a platform default will be used.
As the content is parsed by the underlying parser, methods of the given HandlerBase
are called.
JAXP 1.0
Returns the SAX parser that is encapsultated by the implementation of this class.
public org.xml.sax.Parser getParser()
Deprecated, use getXMLReader()
returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
public java.lang.Object getProperty(java.lang.String name)
name
- The name of the property to be retrieved.
Value of the requested property.
SAXNotRecognizedException
- When the underlying XMLReader does not recognize the property name.
SAXNotSupportedException
- When the underlying XMLReader recognizes the property name but doesn't support the property.
org.xml.sax.XMLReader#getProperty
Returns the XMLReader that is encapsulated by the implementation of this class.
public org.xml.sax.XMLReader getXMLReader()
Indicates whether or not this parser is configured to understand namespaces.
public boolean isNamespaceAware()
Indicates whether or not this parser is configured to validate XML documents.
public boolean isValidating()
Sets the particular property in the underlying implementation of org.xml.sax.XMLReader.
public void setProperty(java.lang.String name, java.lang.Object value)
name
- The name of the property to be set.
value
- The value of the property to be set.
SAXNotRecognizedException
- When the underlying XMLReader does not recognize the property name.
SAXNotSupportedException
- When the underlying XMLReader recognizes the property name but doesn't support the property.
org.xml.sax.XMLReader#setProperty
Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents.
public class JXSAXParserFactory oracle.xml.jaxp.JXSAXParserFactory
JAXP 1.0
Default Constructor
public JXSAXParserFactory()
Returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
public boolean getFeature(java.lang.String name)
name
- The name of the property to be retrieved.
Value of the requested property.
SAXNotRecognizedException
- When the underlying XMLReader does not recognize the property name.
SAXNotSupportedException
- When the underlying XMLReader recognizes the property name but doesn't support the property.
org.xml.sax.XMLReader#getProperty
Indicates whether or not the factory is configured to produce parsers which are namespace aware.
public boolean isNamespaceAware()
Creates a new instance of a SAXParser using the currently configured factory parameters.
public javax.xml.parsers.SAXParser newSAXParser()
ParserConfigurationException
- if a parser cannot be created which satisfies the requested configuration.
Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.
public void setFeature(java.lang.String name, boolean value)
name
- The name of the feature to be set.
value
- The value of the feature to be set.
SAXNotRecognizedException
- When the underlying XMLReader does not recognize the property name.
SAXNotSupportedException
- When the underlying XMLReader recognizes the property name but doesn't support the property.
org.xml.sax.XMLReader#setFeature
A JXTransformerFactory instance can be used to create Transformer and Templates objects.
public class JXSAXTransformerFactory oracle.xml.jaxp.JXSAXTransformerFactory
The system property that determines which Factory implementation to create is named "javax.xml.transform.TransformerFactory". This property names a concrete subclass of the TransformerFactory abstract class (in our case, it is JXSAXTransformerFactory). If the property is not defined, a platform default is be used.
This class also provides SAX-specific factory methods. It provides two types of ContentHandlers, one for creating Transformers, the other for creating Templates objects.
If an application wants to set the ErrorHandler or EntityResolver for an XMLReader used during a transformation, it should use a URIResolver to return the SAXSource which provides (with getXMLReader) a reference to the XMLReader.
The default constructor
public JXSAXTransformerFactory()
Get the stylesheet specification(s) associated via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/) with the document document specified in the source parameter, and that match the given criteria.
public javax.xml.transform.Source getAssociatedStylesheet(javax.xml.transform.Source source, java.lang.String media, java.lang.String title, java.lang.String charset)
Note that it is possible to return several stylesheets, in which case they are applied as if they were a list of imports or cascades in a single stylesheet.
source
- The XML source document.
media
- The media attribute to be matched. May be null, in which case the prefered templates will be used (i.e. alternate = no).
title
- The value of the title attribute to match. May be null.
charset
- The value of the charset attribute to match. May be null.
A Source object suitable for passing to the TransformerFactory.
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 error event handler for the TransformerFactory.
public javax.xml.transform.ErrorListener getErrorListener()
The current error handler, which should never be null.
Look up the value of a feature. The feature name is any absolute URI.
public boolean getFeature(java.lang.String name)
name
- The feature name, which is an absolute URI.
The current state of the feature (true or false).
Get the object that is used by default during the transformation to resolve URIs used in document(), xsl:import, or xsl:include.
public javax.xml.transform.URIResolver getURIResolver()
The URIResolver that was set with setURIResolver.
Process the Source into a Templates object, which is a a compiled representation of the source. This Templates object may then be used concurrently across multiple threads.
Syntax
public javax.xml.transform.Templates newTemplates(javax.xml.transform.Source source)
Creating a Templates object allows the TransformerFactory to do detailed performance optimization of transformation instructions, without penalizing runtime transformation.
source
- An object that holds a URL, input stream, etc.
A Templates object capable of being used for transformation purposes, never null.
TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object.
public javax.xml.transform.sax.TemplatesHandler newTemplatesHandler()
A non-null reference to a TransformerHandler, that may be used as a ContentHandler for SAX parse events.
TransformerConfigurationException
- If for some reason the TemplatesHandler cannot be created.
Create a new Transformer object that performs a copy of the source to the result.
public javax.xml.transform.Transformer newTransformer()
source
- An object that holds a URI, input stream, etc.
A Transformer object that may be used to perform a transformation in a single thread, never null.
TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
Process the Source into a Transformer object. Care must be given not to use this object in multiple threads running concurrently. Different TransformerFactories can be used concurrently by different threads.
public javax.xml.transform.Transformer newTransformer(javax.xml.transform.Source source)
source
- An object that holds a URI, input stream, etc.
A Transformer object that may be used to perform a transformation in a single thread, never null.
TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
Get a TransformerHandler object that can process SAX ContentHandler events into a Result. The transformation is defined as an identity (or copy) transformation, for example to copy a series of SAX parse events into a DOM tree.
public javax.xml.transform.sax.TransformerHandler newTransformerHandler()
A non-null reference to a TransformerHandler, that may be used as a ContentHandler for SAX parse events.
TransformerConfigurationException
- If for some reason the TransformerHandler cannot be created.
Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the transformation instructions specified by the argument.
public javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Source src)
src
- The Source of the transformation instructions.
TransformerHandler ready to transform SAX events.
TransformerConfigurationException
- If for some reason the TransformerHandler can not be created.
Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the Templates argument.
public javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Templates templates)
templates
- The compiled transformation instructions.
TransformerHandler ready to transform SAX events.
TransformerConfigurationException
- If for some reason the TransformerHandler can not be created.
Create an XMLFilter that uses the given Source as the transformation instructions.
public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Source src)
src
- The Source of the transformation instructions.
An XMLFilter object, or null if this feature is not supported.
TransformerConfigurationException
- If for some reason the TemplatesHandler cannot be created.
Create an XMLFilter, based on the Templates argument.
public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Templates templates)
templates
- The compiled transformation instructions.
An XMLFilter object, or null if this feature is not supported.
TransformerConfigurationException
- If for some reason the TemplatesHandler cannot be created.
Allows the user to set specific attributes on the underlying implementation. An attribute in this context is defined to be an option that the implementation provides.
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.
Set the error event listener for the TransformerFactory, which is used for the processing of transformation instructions, and not for the transformation itself.
public void setErrorListener(javax.xml.transform.ErrorListener listener)
listener
- The new error listener.
IllegalArgumentException
- if listener is null.
Set an object that is used by default during the transformation to resolve URIs used in xsl:import, or xsl:include.
public void setURIResolver(javax.xml.transform.URIResolver resolver)
resolver
- An object that implements the URIResolver interface, or null.
An instace of this class can transform a source tree into a result tree.
public class JXTransformer oracle.xml.jaxp.JXTransformer
An instance of this class can be obtained with the TransformerFactory.newTransformer
method. This instance may then be used to process XML from a variety of sources and write the transformation output to a variety of sinks.
An object of this class may not be used in multiple threads running concurrently. Different Transformers may be used concurrently by different threads.
A Transformer may be used multiple times. Parameters and output properties are preserved across transformations.
Constructs a JXTransformer object that uses the XSLStylesheet to transform the source.
public JXTransformer()
Constructor is based on
public JXTransformer(oracle.xml.parser.v2.XSLStylesheet templates)
templates
- a XSLStylesheet or Templates
Clear all parameters set with setParameter.
public void clearParameters()
Get the error event handler in effect for the transformation.
public javax.xml.transform.ErrorListener getErrorListener()
The current error handler, which should never be null.
Get a copy of the output properties for the transformation.
public java.util.Properties getOutputProperties()
The properties returned should contain properties set by the user, and properties set by the stylesheet, and these properties are "defaulted" by default properties specified by section 16 of the XSL Transformations (XSLT) W3C Recommendation. The properties that were specifically set by the user or the stylesheet should be in the base Properties list, while the XSLT default properties that were not specifically set should be the default Properties list. Thus, getOutputProperties().getProperty(String key) will obtain any property in that was set by setOutputProperty(String, String)
, setOutputProperties(Properties)
, in the stylesheet, or the default properties, while getOutputProperties().get(String key) will only retrieve properties that were explicitly set by setOutputProperty(String, String)
, setOutputProperties(Properties)
, or in the stylesheet.
Note that mutation of the Properties object returned will not effect the properties that the transformation contains.
If any of the argument keys are not recognized and are not namespace qualified, the property will be ignored. In other words the behaviour is not orthogonal with setOutputProperties.
javax.xml.transform.OutputKeys
, java.util.Properties
Get an output property that is in effect for the transformation.
public java.lang.String getOutputProperty(java.lang.String name)
The property specified may be a property that was set with setOutputProperty, or it may be a property specified in the stylesheet.
name
- A non-null String that specifies an output property name, which may be namespace qualified.
The string value of the output property, or null if no property was found.
IllegalArgumentException
- If the property is not supported.
javax.xml.transform.OutputKeys
Get a parameter that was explicitly set with setParameter or setParameters.
public java.lang.Object getParameter(java.lang.String name)
name
- A parameter name
This method does not return a default parameter value, which cannot be determined until the node context is evaluated during the transformation process.
A parameter that has been set with setParameter, or null if a parameter with the given name was not found.
Get an object that will be used to resolve URIs used in document(), etc.
public javax.xml.transform.URIResolver getURIResolver()
An object that implements the URIResolver interface, or null.
Set the error event listener in effect for the transformation.
public void setErrorListener(javax.xml.transform.ErrorListener listener)
listener
- The new error listener.
IllegalArgumentException
- if listener is null.
Set the output properties for the transformation. These properties will override properties set in the Templates with xsl:output.
public void setOutputProperties(java.util.Properties oformat)
If argument to this function is null, any properties previously set are removed, and the value will revert to the value defined in the templates object.
Pass a qualified property key name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.
For example, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.
oformat
- A set of output properties that will be used to override any of the same properties in affect for the transformation.
IllegalArgumentException
- if any of the argument keys are not recognized and are not namespace qualified.
javax.xml.transform.OutputKeys
, java.util.Properties
Set an output property that will be in effect for the transformation.
public void setOutputProperty(java.lang.String name, java.lang.String value)
Pass a qualified property name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.
For example, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.
The Properties object that was passed to setOutputProperties(Properties)
won't be effected by calling this method.
name
- A non-null String that specifies an output property name, which may be namespace qualified.
value
- The non-null string value of the output property.
IllegalArgumentException
- If the property is not supported, and is not qualified with a namespace.
javax.xml.transform.OutputKeys
Add a parameter for the transformation.
public void setParameter(java.lang.String name, java.lang.Object value)
Pass a qualified name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.
For example, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.
name
- The name of the parameter, which may begin with a namespace URI in curly braces ({}).
value
- The value object. This can be any valid Java object. It is up to the processor to provide the proper object coersion or to simply pass the object on for use in an extension.
Set an object that will be used to resolve URIs used in document(). currently, we do not support URIResolver in document() fuction
public void setURIResolver(javax.xml.transform.URIResolver resolver)
If the resolver argument is null, the URIResolver value will be cleared, and the default behavior will be used.
resolver
- An object that implements the URIResolver interface, or null.
Process the source tree to the output result.
public void transform(javax.xml.transform.Source xmlSource, javax.xml.transform.Result outputTarget)
xmlSource
- The input for the source tree.
outputTarget
- The output target.
TransformerException
- If an unrecoverable error occurs during the course of the transformation.
The classes listed in Table 11-24, "Summary of XSLT Processor Classes" summarizes the XSLT Processor classes contained in the oracle.xml.parser.v2 package.
The oraxsl class provides a command-line interface to applying stylesheets on multiple XML documents. It accepts a number of command-line options that dictate how it should behave.
public class oraxsl extends java.lang.Object java.lang.Object | +--oracle.xml.parser.v2.oraxsl
java oraxsl options* source? stylesheet? result?
Method | Description |
---|---|
Class constructor |
|
Invokes the oraxsl driver |
Class constructor
public oraxsl()
Invokes the oraxsl driver
public static void main(java.lang.String[] args)
Parameter | Description |
---|---|
args |
Command line arguments |
Indicates that an exception occurred during XPath processing.
public class XPathException extendsoracle.xml.parser.v2.XSLException
java.lang.Object | +--java.lang.Throwable | +--java.lang.Exception | +--oracle.xml.util.XMLException | +--oracle.xml.parser.v2.XSLException
| +--oracle.xml.parser.v2.XPathException
java.io.Serializable
public int getErrorID()
Overrride getMessage, in order to construct error message from error id, and error params
public java.lang.String getMessage()
java.lang.Throwable.getMessage() in class java.lang.Throwable
Get localized message based on the XMLError sent as parameter
public java.lang.String getMessage(XMLError
err)
err
- XMLError class used to get the error message
Indicates that an exception occurred during XSL tranformation
public class XSLException extends oracle.xml.util.XMLException java.lang.Object | +--java.lang.Throwable | +--java.lang.Exception | +--oracle.xml.util.XMLException | +--oracle.xml.parser.v2.XSLException
XPathException
java.io.Serializable
public XSLException(String mesg);
Base element for extension elements
public class XSLExtensionElement oracle.xml.parser.v2.XSLExtensionElement
Default Constructor
public XSLExtensionElement()
Get an attribute value as template
protected final String getAttributeTemplateValue( XSLTContext
context, String namespace, String name)
Parameter | Description |
---|---|
context |
XSLTContext |
namespace |
namespace of the attribute |
name |
name of the attribute |
value of the attribute
Get an attribute value
protected final String getAttributeValue(String namespace, String name);
Parameter | Description |
---|---|
namespace |
namespace of the attribute |
name |
name of the attribute |
value of the attribute
Gets the childNodes of the extension elements
protected final java.util.Vector getChildNodes();
nodelist
Function called to extecute the body of the extension elements
public void processAction(XSLTContext
context);
Parameter | Description |
---|---|
context |
XSLTContext |
Process contents of the extension element
protected final void processContent(XSLTContext
context);
Parameter | Description |
---|---|
context |
XSLTContext |
This class provides methods to transform an input XML document using a previously constructed XSLStylesheet
. The transformation effected is as specified by the XSLT 1.0 specification.
public class XSLProcessor oracle.xml.parser.v2.XSLProcessor
Default Constructor
public XSLProcessor();
Gets the value of top-level stylesheet parameter.
public java.lang.Object getParam(String uri, String name)
uri
- namespace URI of the parameter
name
- local name of the paramter
The value of the parameter.
Constructs an XSLStylesheet. XSL function document('') is not supported as there is no way to re-access the input Stylesheet as XMLDocument.
Parameter | Description |
---|---|
xsl |
XSL input |
New XSL Stylesheet
XSLException
on error.
Transforms input XML document. The options are described in Table 11-36:
XMLDocumentFragment
or void
, depending on form of the function.
XSLException
on error.
Removes the value of a top-level stylesheet parameter.
public void removeParam(String uri, String name)
Parameter | Description |
---|---|
uri |
URI of parameter |
name |
parameter name |
XSLException
on error
Resets all the params set.
public void resetParams()
XSLException
on error
Set base url to resolve include/import hrefs. EntityResolver if set is used before using the base url. See also setEntityResolver().
public void setBaseURL(java.net.URL url)
Parameter | Description |
---|---|
url |
Base URL to be set |
Set entity resolver to resolve include/import hrefs. If not set, base url (if set) is used.
public void setEntityResolver(org.xml.sax.EntityResolver eResolver)
Parameter | Description |
---|---|
eResolver |
Entity resolver |
Creates an output stream for the output of warnings. If an output stream for warnings is not specified, the processor will not output any warnings.
public final void setErrorStream(java.io.OutputStream out)
Parameter | Description |
---|---|
out |
The output stream to use for errros and warnings |
Applications can use this to set the locale for error reporting.
public void setLocale(java.util.Locale locale)
Parameter | Description |
---|---|
locale |
Locale to set |
Sets the value of a top-level stylesheet parameter.
The parameter value is expected to be a valid XPath expression (note that string literal values would therefore have to be explicitly quoted). The param functions CANNOT be used along with param functions in XSLStylesheet. If the param functions in XSLProcessor are used, any parameters set using XSLStylesheet functions will be ignored.
public void setParam(String uri, String name, Object value)
Parameter | Description |
---|---|
uri |
URI of parameter |
name |
Parameter name |
value |
Parameter value; Strings are treated as XPath Expr for backward compatibility) |
XSLException
on error
Switch to determine whether to output warnings.
public final void showWarnings(boolean flag)
Parameter | Description |
---|---|
flag |
Determines whether warning should be shown; default: warnings not output |
The class holds XSL stylesheet information such as templates, keys, variables, and attribute sets. The same stylesheet, once constructed, can be used to transform multiple XML documents.
public class XSLStylesheet oracle.xml.parser.v2.XSLStylesheet
Field | Syntax | Description |
---|---|---|
output |
public oracle.xml.parser.v2.XSLOutput output |
Get the decimal format symbols specified in the stylesheet
public java.text.DecimalFormatSymbols getDecimalFormat(NSName
nsname)
Parameter | Description |
---|---|
nsname |
Qualified name from xsl decimal-format |
DecimalFormatSymbols
Get the value of the encoding specified in xsl:output
public java.lang.String getOutputEncoding()
The encoding
Get the value of the media-type specified in xsl:output
public java.lang.String getOutputMediaType()
the media type
Returns the output properties specified in xsl:output
as java.util.Properties
.
public java.util.Properties getOutputProperties()
Returns a JAXP Transformer object that uses this stylesheet for transformation.
public javax.xml.transform.Transformer newTransformer()
public class XSLTContext extends java.lang.Object java.lang.Object | +--oracle.xml.parser.v2.XSLTContext
Class for Xpath processing Context
Get the current context node
public XMLNode
getContextNode()
XMLNode current context node
Get the current context node position
public int getContextPosition()
int current context node position
Get the current context size
public int getContextSize()
int current context size
Get the XMLError instance for reporting errors
public XMLError
getError()
XMLError
Retrieve variable at the given stack offset
public getVariable(NSName
name, int offset)
Parameter | Description |
---|---|
name |
name of the variable |
offset |
offset of the variable |
Report characters to the current output handler
public void reportCharacters(String data, boolean disableoutesc)
Report a XMLNode to the current output handler
public void reportNode(XMLNode
node)
Parameter | Description |
---|---|
node |
node to be output |
Set the XMLError
public void setError(XMLError
err)
Parameter | Description |
---|---|
err |
instance of XMLError |
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|