Skip Headers

Oracle9i Supplied Java Packages Reference
Release 2 (9.2)

Part Number A96609-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

11
Package oracle.xml.parser.v2

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:


Package oracle.xml.parser.v2 Description

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.

See Also:

Package oracle.xml.parser.v2 Summary

The tables in this section summarize the oracle.xml.parser.v2 interfaces and classes documented in this chapter.

Table 11-1  oracle.xml.parser.v2 Package Interfaces
Interface Description

NSResolver Interface

Provides support for resolving Namespaces.

PrintDriver Interface

The PrintDriver interface defines methods used to print XML documents represented as DOM trees.

XMLToken Interface

Basic interface for XMLToken.

Table 11-2  oracle.xml.parser.v2 Package Classes
Class Description

AttrDecl

Holds information about each attribute declared in an attribute list in the Document Type Definition (DTD).

DefaultXMLDocumentHandler

Implements the default behaviour for the XMLDocumentHandler interface.

DOMParser

Implements an eXtensible Markup Language (XML) 1.0 parser according to the World Wide Web Consortium (W3C) recommendation.

DTD

Implements the DOM DocumentType interface and holds the Document Type Definition (DTD) information for an XML document.

ElementDecl

Represents an element declaration in a Document Type Definition DTD.

NodeFactory

Specifies methods to create various nodes of the DOM tree built during parsing.

oraxml

Implements the XML Decl Processing Instruction.

SAXAttrList

Implements the SAX AttributeList interface and also provides Namespace support.

SAXParser

Implements an eXtensible Markup Language (XML) 1.0 SAX parser according to the World Wide Web Consortium (W3C) recommendation.

XMLAttr

Implements the DOM Attr interface and holds information on each attribute of an element.

XMLCDATA

Implements the DOM CDATASection interface.

XMLComment

Implements the DOM Comment interface.

XMLDeclPI

Implements the XML Decl Processing Instruction.

XMLDocument

This class implements the DOM Document interface, represents an entire XML document and serves the root of the Document Object Model tree.

XMLDocumentFragment

This class implements the DOM DocumentFragment interface.

XMLDOMImplementation

Implements the DOMImplementation.

XMLElement

This class implements the DOM Element interface.

XMLEntityReference

Implements DOM EntityReference interface.

XMLNode

Implements the DOM Node interface and serves as the primary datatype for the entire Document Object Model.

XMLParser

This class serves as a base class for the DOMParser and SAXParser classes.

XMLPI

This class implements the DOM Processing Instruction interface.

XMLText

This class implements the DOM Text interface.

XMLTokenizer

This class implements an eXtensible Markup Language (XML) 1.0 parser according to the World Wide Web Consortium (W3C) recommendation.

Table 11-3  oracle.xml.parser.v2 Package Exceptions
Exception Description

XMLDOMException

Indicates an exception in DOM operation.

XMLParseException

Indicates that a parsing exception occurred while processing an XML document

XMLRangeException

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.

Table 11-4  Summary of XSLT Processor Classes in package oracle.xml.parserv2
Class Description

oraxsl Class

Provides a command-line interface to applying stylesheets on multiple XML documents.

XPathException Class

Indicates that an exception occurred during XSL tranformation.

XSLProcessor Class

Provides methods to transform an input XML document using a previously constructed XSLStylesheet.

XSLStylesheet Class

Holds XSL stylesheet information such as templates, keys, variables, and attribute sets.


NSResolver Interface

Syntax of NSResolver

public interface NSResolver

Description of NSResolver

This interface provides support for resolving Namespaces

Known Implementing Classes of NSResolver

XMLElement


Methods

resolveNamespacePrefix(String)

Description

Find the namespace definition in scope for a given namespace prefix

Syntax

public java.lang.String resolveNamespacePrefix(java.lang.String prefix)

Parameters

prefix - Namespace prefix to be resolved

Returns

the resolved Namespace (null, if prefix could not be resolved)


PrintDriver Interface

Description of PrintDriver

The PrintDriver interface defines methods used to print XML documents represented as DOM trees.

Syntax of PrintDriver

public interface PrintDriver

Implementing Classes of PrintDriver

XMLPrintDriver


Methods

Table 11-5  Summary of Methods of PintDriver
Method Description

close()

Closes the output stream or print writer

flush()

Flushes the output stream or print writer

printAttribute( XMLAttr)

Prints a XMLAttr node

printAttributeNodes( XMLElement)

Calls print method for each attribute of the XMLElement

printCDATASection( XMLCDATA)

Prints a XMLCDATA node

printChildNodes( XMLNode)

Calls print method for each child of the XMLNode

printComment( XMLComment)

Prints a XMLComment node

printDoctype( DTD)

Prints an DTD.

printDocument( XMLDocument)

Prints an XMLDocument.

printDocumentFragment( XMLDocumentFragment)

Prints an empty XMLDocumentFragment object.

printElement( XMLElement)

Prints an XMLElement.

printEntityReference( XMLEntityReference)

Prints a XMLEntityReference node

printProcessingInstruction( XMLPI)

Prints a XMLPI node

printTextNode( XMLText)

Prints a XMLText node

setEncoding( String)

Sets the encoding of the print driver.

close()

Description

Closes the output stream or print writer

Syntax

public void close()

flush()

Description

Flushes the output stream or print writer

Syntax

public void flush()

printAttribute(XMLAttr)

Description

Prints a XMLAttr node

Syntax

public void printAttribute(XMLAttr attr)

Parameters

attr - The XMLAttr node.

printAttributeNodes(XMLElement)

Description

Calls print method for each attribute of the XMLElement

Syntax

public void printAttributeNodes(XMLElement elem)

Parameters

elem - The elem whose attributes are to be printed.

printCDATASection(XMLCDATA)

Description

Prints a XMLCDATA node

Syntax

public void printCDATASection(XMLCDATA cdata)

Parameters

cdata - The XMLCDATA node.

printChildNodes(XMLNode)

Description

Calls print method for each child of the XMLNode

Syntax

public void printChildNodes(XMLNode node)

Parameters

node - The node whose children are to be printed.

printComment(XMLComment)

Description

Prints a XMLComment node

Syntax

public void printComment(XMLComment comment)

Parameters

comment - The comment node.

printDoctype(DTD)

Description

Prints an DTD.

Syntax

public void printDoctype(DTD dtd)

Parameters

dtd - The dtd to be printed.

printDocument(XMLDocument)

Description

Prints an XMLDocument.

Syntax

public void printDocument(XMLDocument doc)

Parameters

elem - The document to be printed.

printDocumentFragment(XMLDocumentFragment)

Syntax

public void printDocumentFragment(XMLDocumentFragment dfrag)

Description

Prints an empty XMLDocumentFragment object.

Parameters

dfrag - The document fragment to be printed.

printElement(XMLElement)

Syntax

public void printElement(XMLElement elem)

Description

Prints an XMLElement.

Parameters

elem - The element to be printed.

printEntityReference(XMLEntityReference)

Description

Prints a XMLEntityReference node

Syntax

public void printEntityReference(XMLEntityReference en)

Parameters

en - The XMLEntityReference node.

printProcessingInstruction(XMLPI)

Description

Prints a XMLPI node

Syntax

public void printProcessingInstruction(XMLPI pi)

Parameters

pi - The XMLPI node.

printTextNode(XMLText)

Description

Prints a XMLText node

Syntax

public void printTextNode(XMLText text)

Parameters

text - The text node.

setEncoding(String)

Description

Sets the encoding of the print driver.

Syntax

public void setEncoding(java.lang.String enc)

Parameters

enc - The encoding of the document being printed.


NSName

Interface in package oracle.xml.util.

Description

Part of package oracle.xml.util. This interface provides Namespace support for Element and Attr names.

Syntax

public interface NSName

Methods

getExpandedName()

Description

Get the fully resolved name for this name

Syntax

public java.lang.String getExpandedName()

Returns

The fully resolved name

getLocalName()

Description

Get the local name for this name

Syntax

public java.lang.String getLocalName()

Returns

The local name

getNamespace()

Description

Get the resolved Namespace for this name

Syntax

public java.lang.String getNamespace()

Returns

The resolved Namespace

getPrefix()

Description

Get the prefix for this name

Syntax

public java.lang.String getPrefix()

Returns

The prefix

getQualifiedName()

Description

Get the qualified name

Syntax

public java.lang.String getQualifiedName()

Returns

The qualified name


AttrDecl

Description

This class hold information about each attribute declared in an attribute list in the Document Type Definition.

Syntax

public class AttrDecl implements java.io.Externalizable
 
oracle.xml.parser.v2.AttrDecl

Implemented Interfaces

java.io.Externalizable, java.io.Serializable

Fields

Table 11-6 Fields of AttrDecl
Field Syntax Description

CDATA

public static final int CDATA

AttType - StringType - CDATA

DEFAULT

public static final int DEFAULT

Attribute presence - Default

ENTITIES

public static final int ENTITIES

AttType - TokenizedType - Entities

ENTITY

public static final int ENTITY

AttType - TokenizedType - Entity

ENUMERATION

public static final int ENUMERATION

AttType - EnumeratedType - Enumeration

FIXED

public static final int FIXED

Attribute presence - Fixed

ID

public static final int ID

AttType - TokenizedType - ID

IDREF

public static final int IDREF

AttType - TokenizedType - ID reference

IDREFS

public static final int IDREFS

AttType - TokenizedType - ID references

IMPLIED

public static final int IMPLIED

Attribute presence - Implied

NMTOKEN

public static final int NMTOKEN

AttType - TokenizedType - Name token

NMTOKENS

public static final int NMTOKENS

AttType - TokenizedType - Name tokens

NOTATION

public static final int NOTATION

AttType - EnumeratedType - Notation

REQUIRED

public static final int REQUIRED

Attribute presence - Required


Constructors

AttrDecl()

Description

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.

Syntax

public static final int REQUIRED public  AttrDecl()


Methods

Table 11-7  Summary of Methods of AttrDecl
Methods Description

getAttrPresence()

Gets attribute presence

getAttrType()

Gets attribute type

getDefaultValue

Gets attribute default value

getEnumerationValues()

Gets attribute values

getNodeName()

Gets the name of the Attr Decl

getNodeType()

Gets a code representing the type of the underlying object

getExternal(ObjectInput)

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly

readExternal(ObjectInput)

Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

typeToString (int)

Gets a string representation of the attribute type

writeExternal(ObjectOutput)

This method saves the state of the object by creating a binary compressed stream with information about this object.

getAttrPresence()

Description

Gets attribute presence

Syntax

public int getAttrPresence()

Returns

The presence of the attribute

getAttrType()

Description

Gets attribute type

Syntax

public int getAttrType()

Returns

The type of the attribute

getDefaultValue()

Description

Gets attribute default value

Syntax

public java.lang.String getDefaultValue()

Returns

The default value of the attribute

getEnumerationValues()

Description

Gets attribute values

Syntax

public java.util.Vector getEnumerationValues()

Returns

The values of the attribute as an Enumeration

getNodeName()

Description

Gets the name of the Attr Decl.

Syntax

public java.lang.String getNodeName()

Returns

Name of the node

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - the ObjectInput stream used for reading the compressed stream.

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

typeToString(int)

Description

Gets a string representation of the attribute type

Syntax

public static java.lang.String typeToString(int type)

Returns

A string representing the attribute type

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

outArg - The ObjectOutput stream used to write the serialized/ compressed stream.

Throws

IOException - is thrown when there is an exception while writing the serialized/compressed stream.


DefaultXMLDocumentHandler

Description of DefaultXMLDocumentHandler

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

Syntax of DefaultXMLDocumentHandler

public class DefaultXMLDocumentHandler implements 
oracle.xml.parser.v2.XMLDocumentHandler
 
oracle.xml.parser.v2.DefaultXMLDocumentHandler

Implemented Interfacesof DefaultXMLDocumentHandler

XMLDocumentHandler


Constructors

DefaultXMLDocumentHandler()

Description

Constructs a default document

Syntax

public  DefaultXMLDocumentHandler()

Methods

Table 11-8  Summary of Methods of DefaultXMLDocumentHandler
Methods Description

cDATASection(char[], int, int)

Receive notification of a CDATA Section. The Parser will invoke this method once for each CDATA Section found.

comment(String)

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.

endDoctype()

Receive notification of end of the DTD.

endElement(NSName)

Receive notification of the end of an element.

endElement(String, String, String)

Receive notification of the end of an element.

endPrefixMapping(String)

End the scope of a prefix-URI mapping.

getHandler()

Get the next pipe-line node handler.

setDoctype(DTD)

Receive notification of DTD. Sets the DTD.

setError(XMLError)

Receive notification of a XMLError handler.

setHandler(XMLDocumentHandler)

Receive notification of a next pipe-line node handler.

setTextDecl(String, String)

Receive notification of a Text XML Declaration. The Parser will invoke this method once for each text XML Decl

setXMLDecl(String, String, String)

Receive notification of an XML Declaration. The Parser will invoke this method once for XML Decl.

setXMLSchema(Object)

Receive notification of a XMLSchema object.

skippedEntity(String)

Receive notification of a skipped entity.

startElement(NSName, SAXAttrList)

Receive notification of the beginning of an element.

startElement(String, String, String, Attributes)

Receive notification of the beginning of an element.

startPrefixMapping(String, String)

Begin the scope of a prefix-URI Namespace mapping.

cDATASection(char[], int, int)

Description

Receive notification of a CDATA Section. The Parser will invoke this method once for each CDATA Section found.

Syntax

public void cDATASection(char[] ch, int start, int length)

Specified By

XMLDocumentHandler.cDATASection(char[], int, int) in interface XMLDocumentHandler

Parameters

ch - The CDATA section characters.

start - The start position in the character array.

length - The number of characters to use from the character array.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

comment(String)

Description

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.

Syntax

public void comment(java.lang.String data)

Specified By

XMLDocumentHandler.comment(String) in interface XMLDocumentHandler

Parameters

data - The comment data, or null if none was supplied.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endDoctype()

Description

Receive notification of end of the DTD.

Syntax

public void endDoctype()

Specified By

XMLDocumentHandler.endDoctype() in interface XMLDocumentHandler

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endElement(NSName)

Description

Receive notification of the end of an element.

Syntax

public void endElement(NSName elem)

Specified By

XMLDocumentHandler.endElement(NSName) in interface XMLDocumentHandler

Parameters

elem - NSName object

Throws

SAXException - A SAXException could be thrown.

See Also

org.xml.sax.DocumentHandler#endElement

endElement(String, String, String)

Description

Receive notification of the end of an element.

Syntax

public void endElement(java.lang.String namespaceURI, java.lang.String 
localName, java.lang.String qName)

Parameters

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.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endPrefixMapping(String)

Description

End the scope of a prefix-URI mapping.

Syntax

public void endPrefixMapping(java.lang.String prefix)

Parameters

prefix - The prefix that was being mapping.

Throws

org.xml.sax.SAXException - The client may throw an exception during processing.

See Also

startPrefixMapping(String, String), endElement(NSName)

getHandler()

Description

Get the next pipe-line node handler.

Syntax

public XMLDocumentHandler getHandler()

Specified By

XMLDocumentHandler.getHandler() in interface XMLDocumentHandler

Returns

The XMLDocumentHandler node

setDoctype(DTD)

Description

Receive notification of DTD. Sets the DTD.

Syntax

public void setDoctype(DTD dtd)

Specified By

XMLDocumentHandler.setDoctype(DTD) in interface XMLDocumentHandler

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

setError(XMLError)

Description

Receive notification of a XMLError handler.

Syntax

public void setError(XMLError he)

Specified By

XMLDocumentHandler.setError(XMLError) in interface XMLDocumentHandler

Parameters

err - The XMLError object

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

setHandler(XMLDocumentHandler)

Description

Receive notification of a next pipe-line node handler.

Syntax

public void setHandler(XMLDocumentHandler h)

Specified By

XMLDocumentHandler.setHandler(XMLDocumentHandler) in interface XMLDocumentHandler

h - The XMLDocumentHandler node

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

setTextDecl(String, String)

Description

Receive notification of a Text XML Declaration. The Parser will invoke this method once for each text XML Decl

Syntax

public void setTextDecl(java.lang.String version, java.lang.String encoding)

Specified By

XMLDocumentHandler.setTextDecl(String, String) in interface XMLDocumentHandler

Parameters

version - The version number (or null, if not specified)

encoding - The encoding name

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

setXMLDecl(String, String, String)

Description

Receive notification of an XML Declaration. The Parser will invoke this method once for XML Decl.

Syntax

public void setXMLDecl(java.lang.String version, java.lang.String standalone, 
java.lang.String encoding)

Specified By

XMLDocumentHandler.setXMLDecl(String, String, String) in interface XMLDocumentHandler

Parameters

version - The version number

standalone - The standalone value (or null, if not specifed)

encoding - The encoding name (or null, if not specifed)

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

setXMLSchema(Object)

Description

Receive notification of a XMLSchema object.

Syntax

public void setXMLSchema(java.lang.Object s)

Specified By

XMLDocumentHandler.setXMLSchema(Object) in interface XMLDocumentHandler

Parameters

s - The XMLSchema object

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

skippedEntity(String)

Description

Receive notification of a skipped entity.

Syntax

public void skippedEntity(java.lang.String name)

Parameters

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]".

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

startElement(NSName, SAXAttrList)

Description

Receive notification of the beginning of an element.

Syntax

public void startElement(NSName elem, SAXAttrList attrlist)

Specified By

XMLDocumentHandler.startElement(NSName, SAXAttrList) in interface XMLDocumentHandler

Parameters

elem - NSName object

attrlist - SAXAttrList for the element

Throws

SAXException - A SAXException could be thrown.

See Also

org.xml.sax.DocumentHandler#startElement

startElement(String, String, String, Attributes)

Description

Receive notification of the beginning of an element.

Syntax

public void startElement(java.lang.String namespaceURI, java.lang.String 
localName, java.lang.String qName, org.xml.sax.Attributes atts)

Parameters

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.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

See Also

endElement(NSName), org.xml.sax.Attributes

startPrefixMapping(String, String)

Description

Begin the scope of a prefix-URI Namespace mapping.

Syntax

public void startPrefixMapping(java.lang.String prefix, java.lang.String uri)

Parameters

prefix - The Namespace prefix being declared.

uri - The Namespace URI the prefix is mapped to.

Throws

org.xml.sax.SAXException - The client may throw an exception during processing.

See Also

endPrefixMapping(String), startElement(NSName, SAXAttrList)


DocumentBuilder

Syntax of DocumentBuilder

public class DocumentBuilder
 
oracle.xml.parser.v2.DocumentBuilder

Description of 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


Constructors

DocumentBuilder()

Description

Default Constructor. Creates a document builder that can be used as XMLDocumentHandler

Syntax

public  DocumentBuilder()

Methods

Table 11-9  Summary of Methods of DocumentBuilder
Methods Description

attributeDecl(String, String, String, String, String)

Report an attribute type declaration.

cDATASection(char[], int, int)

Receive notification of CDATA Section data inside an element.

characters(char[], int, int)

Receive notification of character data inside an element.

comment(char[], int, int)

Report an XML comment anywhere in the document.

comment(String)

Receive notification of a comment.

elementDecl(String, String)

Report an element type declaration.

endCDATA()

Report the end of a CDATA section.

endDoctype()

Receive notification of end of the DTD.

endDocument()

Receive notification of the end of the document.

endDTD()

Report the end of DTD declarations.

endElement(NSName)

Receive notification of the end of an element.

endElement(Sring, String, String)

Receive notification of the end of an element.

endEntity(String)

Report the end of an entity.

externalEntityDecl(String, String, String)

Report a parsed external entity declaration.

getCurrentNode()

Get the current node being build

getDocument()

Get the document being build

ignorableWhitespace(char[], int, int)

Receive notification of ignorable whitespace in element content.

internalEntityDecl(String, String)

Report an internal entity declaration

processingInstruction(String, String)

Receive notification of a processing instruction.

retainCDATASection(boolean)

Sets a flag to retain CDATA sections

setDebugMode(boolean)

Sets a flag to turn on debug information in the document

setDoctype(DTD)

Receive notification of DTD Sets the DTD

setDocumentLocator(Locator)

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.

setNodeFactory(NodeFactory)

Set a optional NodeFactory to be used for creating custom DOM trees

setTextDecl(String, String)

Receive notification of a Text XML Declaration. The Parser will invoke this method once for each text XML Decl.

setXMLDecl(String, String, String)

Receive notification of a XML Declaration. The Parser will invoke this method once for XML Decl .

startCDATA()

Report the start of a CDATA section.

startDocument()

Receive notification of the beginning of the document.

startDTD(String, String, String)

Report the start of DTD declarations, if any.

startElement(NSName, SAXAttrList)

Receive notification of the beginning of an element.

startElement(String, String, String, Attributes)

Receive notification of the beginning of an element.

startEntity(String)

Report the beginning of some internal and external XML entities. All start/endEntity events must be properly nested.

attributeDecl(String, String, String, String, String)

Description

Report an attribute type declaration.

Syntax

public void attributeDecl(java.lang.String eName, java.lang.String aName, 
java.lang.String type, java.lang.String valueDefault, java.lang.String value)

Parameters

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.

Throws

SAXException - The application may raise an exception.

cDATASection(char[ ], int, int)

Description

Receive notification of CDATA Section data inside an element.

Syntax

public void cDATASection(char[] ch, int start, int length)

Parameters

ch - The CDATA characters.

start - The start position in the character array.

length - The number of characters to use from the character array.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

See Also

org.xml.sax.DocumentHandler#characters

characters(char[], int, int)

Description

Receive notification of character data inside an element.

Syntax

public void characters(char[] ch, int start, int length)

Parameters

ch - The characters.

start - The start position in the character array.

length - The number of characters to use from the character array.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

See Also

org.xml.sax.DocumentHandler#characters

comment(char[], int, int)

Description

Report an XML comment anywhere in the document.

Syntax

public void comment(char[] ch, int start, int length)

Parameters

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.

Throws

SAXException - The application may raise an exception.

comment(String)

Description

Receive notification of a comment.

Syntax

public void comment(java.lang.String data)

Parameters

data - The comment data, or null if none was supplied.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

elementDecl(String, String)

Description

Report an element type declaration.

Syntax

public void elementDecl(java.lang.String name, java.lang.String model)

Parameters

name - The element type name.

model - The content model as a normalized string.

Throws

SAXException - The application may raise an exception.

endCDATA()

Description

Report the end of a CDATA section.

Syntax

public void endCDATA()

Throws

SAXException - The application may raise an exception.

See Also

startCDATA()

endDoctype()

Description

Receive notification of end of the DTD.

Syntax

public void endDoctype()

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endDocument()

Description

Receive notification of the end of the document.

Syntax

public void endDocument()

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

See Also

org.xml.sax.DocumentHandler#endDocument

endDTD()

Description

Report the end of DTD declarations.

Syntax

public void endDTD()

Throws

SAXException - The application may raise an exception.

See Also

startDTD(String, String, String)

endElement(NSName)

Description

Receive notification of the end of an element.

Syntax

public void endElement(NSName elem)

Parameters

elem - NSName object

Throws

SAXException - A SAXException could be thrown.

See Also

org.xml.sax.DocumentHandler#endElement

endElement(String, String, String)

Description

Receive notification of the end of an element.

Syntax

public void endElement(java.lang.String namespaceURI, java.lang.String 
localName, java.lang.String qName)

Parameters

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.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endEntity(String)

Description

Report the end of an entity.

Syntax

public void endEntity(java.lang.String name)

Parameters

name - The name of the entity that is ending.

Throws

SAXException - The application may raise an exception.

See Also

startEntity(String)

externalEntityDecl(String, String, String)

Description

Report a parsed external entity declaration.

Syntax

public void externalEntityDecl(java.lang.String name, java.lang.String publicId, 
java.lang.String systemId)

Parameters

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.

Throws

SAXException - The application may raise an exception.

See Also

internalEntityDecl(String, String), org.xml.sax.DTDHandler#unparsedEntityDecl

getCurrentNode()

Description

Get the current node being build

Syntax

public XMLNode getCurrentNode()

Returns

XMLNode

getDocument()

Description

Get the document being build

Syntax

public XMLDocument getDocument()

Returns

XMLDocument

ignorableWhitespace(char[], int, int)

Description

Receive notification of ignorable whitespace in element content.

Syntax

public void ignorableWhitespace(char[] ch, int start, int length)

Parameters

ch - The whitespace characters.

start - The start position in the character array.

length - The number of characters to use from the character array.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

See Also

org.xml.sax.DocumentHandler#ignorableWhitespace

internalEntityDecl(String, String)

Description

Report an internal entity declaration.

Syntax

public void internalEntityDecl(java.lang.String name, java.lang.String value)

Parameters

name - The name of the entity. If it is a parameter entity, the name will begin with '%'.

value - The replacement text of the entity.

Throws

SAXException - The application may raise an exception.

See Also

externalEntityDecl(String, String, String), org.xml.sax.DTDHandler#unparsedEntityDecl

processingInstruction(String, String)

Description

Receive notification of a processing instruction.

Syntax

public void processingInstruction(java.lang.String target, java.lang.String 
data)

Parameters

target - The processing instruction target.

data - The processing instruction data, or null if none is supplied.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

See Also

org.xml.sax.DocumentHandler#processingInstruction

retainCDATASection(boolean)

Description

Sets a flag to retain CDATA sections

Syntax

public void retainCDATASection(boolean flag)

Parameters

flag - determines whether CDATA sections are retained

setDebugMode(boolean)

Description

Sets a flag to turn on debug information in the document

Syntax

public void setDebugMode(boolean flag)

Parameters

flag - determines whether debug info is stored

setDoctype(DTD)

Description

Receive notification of DTD Sets the DTD

Syntax

public void setDoctype(DTD dtd)

Parameters

dtd - set the DTD for the document

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

setDocumentLocator(Locator)

Description

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.

Syntax

public void setDocumentLocator(org.xml.sax.Locator locator)

Parameters

locator - A locator for all SAX document events.

See Also

org.xml.sax.DocumentHandler#setDocumentLocator, org.xml.sax.Locator

setNodeFactory(NodeFactory)

Description

Set a optional NodeFactory to be used for creating custom DOM trees

Syntax

public void setNodeFactory(NodeFactory f)

Parameters

f - NodeFactory

setTextDecl(String, String)

Description

Receive notification of a Text XML Declaration. The Parser will invoke this method once for each text XML Decl

Syntax

public void setTextDecl(java.lang.String version, java.lang.String encoding)

Parameters

version - The version number (or null, if not specified)

encoding - The encoding name

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

setXMLDecl(String, String, String)

Description

Receive notification of a XML Declaration. The Parser will invoke this method once for XML Decl .

Syntax

public void setXMLDecl(java.lang.String version, java.lang.String standalone, 
java.lang.String encoding)

Parameters

version - The version number

standalone - The standalone value (or null, if not specifed)

encoding - The encoding name (or null, if not specifed)

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

startCDATA()

Description

Report the start of a CDATA section.

Syntax

public void startCDATA()

Throws

SAXException - The application may raise an exception.

See Also

endCDATA()

startDocument()

Description

Receive notification of the beginning of the document.

Syntax

public void startDocument()

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

See Also

org.xml.sax.DocumentHandler#startDocument

startDTD(String, String, String)

Description

Report the start of DTD declarations, if any.

Syntax

public void startDTD(java.lang.String name, java.lang.String publicId, 
java.lang.String systemId)

Parameters

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.

Throws

SAXException - The application may raise an exception.

See Also

endDTD(), startEntity(String)

startElement(NSName, SAXAttrList)

Description

Receive notification of the beginning of an element.

Syntax

public void startElement(NSName elem, SAXAttrList attrlist)

Parameters

elem - NSName object

attrlist - SAXAttrList for the element

Throws

SAXException - A SAXException could be thrown.

See Also

org.xml.sax.DocumentHandler#startElement

startElement(String, String, String, Attributes)

Description

Receive notification of the beginning of an element.

Syntax

public void startElement(java.lang.String namespaceURI, java.lang.String 
localName, java.lang.String qName, org.xml.sax.Attributes atts)

Parameters

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.

Throws

org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

See Also

endElement(NSName), org.xml.sax.Attributes

startEntity(String)

Description

Report the beginning of some internal and external XML entities. All start/endEntity events must be properly nested.

Syntax

public void startEntity(java.lang.String name)

Parameters

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]".

Throws

SAXException - The application may raise an exception.

See Also

endEntity(String), org.xml.sax.ext.DeclHandler, org.xml.sax.ext.DeclHandler


DOMParser

Syntax of DOMParser

public class DOMParser
 
oracle.xml.parser.v2.DOMParser

Description of 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.

Fields of DOMParser

Table 11-10 Fields of DOMParser
Field Syntax Description

DEBUG_MODE

public static final java.lang.String DEBUG_MODE

Sets Debug Mode Boolean.TRUE or Boolean.FALSE

ERROR_ENCODING

public static final java.lang.String ERROR_ENCODING

Encoding for errors report via error stream (only if ERROR_STREAM is set).

ERROR_STREAM

public static final java.lang.String ERROR_STREAM

Error stream for reporting errors. The object can be OutputStream or PrintWriter. This attribute is ignored if ErrorHandler is set.

NODE_FACTORY

public static final java.lang.String NODE_FACTORY

Set NodeFactory to build custom Nodes

SHOW_WARNINGS

public static final java.lang.String SHOW_WARNINGS

Boolean to ignore warnings Boolean.TRUE or Boolean.FALSE


Constructors of DOMParser

DOMParser()

Description

Creates a new parser object.

Syntax

public  DOMParser()

Methods of DOMParser

Table 11-11 Summary of Methods of DOMParser
Methods Description

getAttribute( String)

Allows the user to retrieve specific attributes on the underlying implementation.

getDoctype()

Get the DTD

getDocument()

Gets the document

parseDTD( InputSource, String)

Parses the XML External DTD from given input source

parseDTD( InputStream, String)

Parses the XML External DTD from given input stream. The base URL should be set for resolving external entities and DTD.

parseDTD( Reader, String)

Parses the XML External DTD from given input stream. The base URL should be set for resolving external entities and DTD.

parseDTD( String, String)

Parses the XML External DTD from the URL indicated

parseDTD( URL, String)

Parses the XML External DTD document pointed to by the given URL and creates the corresponding XML document hierarchy.

reset()

Resets the parser state

retainCDATASection( boolean)

Switch to determine whether to retain CDATA sections

setAttribute( String, Object)

Allows the user to set specific attributes on the underlying implementation.

setDebugMode( boolean)

Sets a flag to turn on debug information in the document

setErrorStream( OutputStream)

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.

setErrorStream( OutputStream, String)

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.

setErrorStream( PrintWriter)

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.

setNodeFactory( NodeFactory)

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.

showWarnings( boolean)

Switch to determine whether to print warnings

getAttribute(String)

Description

Allows the user to retrieve specific attributes on the underlying implementation.

Syntax

public java.lang.Object getAttribute(java.lang.String name)

Parameters

name - The name of the attribute.

Returns

value The value of the attribute.

Throws

IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

getDoctype()

Description

Get the DTD

Syntax

public DTD getDoctype()

Returns

The DTD

getDocument()

Description

Gets the document

Syntax

public XMLDocument getDocument()

Returns

The document being parsed

parseDTD(InputSource, String)

Description

Parses the XML External DTD from given input source

Syntax

public final void parseDTD(org.xml.sax.InputSource in, java.lang.String 
rootName)

Parameters

in - the org.xml.sax.InputSouce to parse

rootName - the element to be used as root Element

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

parseDTD(InputStream, String)

Description

Parses the XML External DTD from given input stream. The base URL should be set for resolving external entities and DTD.

Syntax

public final void parseDTD(java.io.InputStream in, java.lang.String rootName)

Parameters

in - the InputStream containing XML data to parse.

rootName - the element to be used as root Element

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

See Also

XMLParser.setBaseURL(URL)

parseDTD(Reader, String)

Description

Parses the XML External DTD from given input stream. The base URL should be set for resolving external entities and DTD.

Syntax

public final void parseDTD(java.io.Reader r, java.lang.String rootName)

Parameters

r - the Reader containing XML data to parse.

rootName - the element to be used as root Element

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

See Also

XMLParser.setBaseURL(URL)

parseDTD(String, String)

Description

Parses the XML External DTD from the URL indicated

Syntax

public final void parseDTD(java.lang.String in, java.lang.String rootName)

Parameters

in - the String containing the URL to parse from

rootName - the element to be used as root Element

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

parseDTD(URL, String)

Description

Parses the XML External DTD document pointed to by the given URL and creates the corresponding XML document hierarchy.

Syntax

public final void parseDTD(java.net.URL url, java.lang.String rootName)

Parameters

url - the url points to the XML document to parse.

rootName - the element to be used as root Element

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

reset()

Description

Resets the parser state.

Syntax

public void reset()

retainCDATASection(boolean)

Description

Switch to determine whether to retain CDATA sections

Syntax

public void retainCDATASection(boolean flag)

Parameters

flag - TRUE - keep CDATASections (default) FALSE - convert CDATASection to Text nodes

setAttribute(String, Object)

Description

Allows the user to set specific attributes on the underlying implementation.

Syntax

public void setAttribute(java.lang.String name, java.lang.Object value)

Parameters

name - The name of the attribute.

value - The value of the attribute.

Throws

IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

setDebugMode(boolean)

Description

Sets a flag to turn on debug information in the document

Syntax

public void setDebugMode(boolean flag)

Parameters

flag - determines whether debug info is stored

setErrorStream(OutputStream)

Description

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.

Syntax

public final void setErrorStream(java.io.OutputStream out)

Parameters

out - The output stream to use for errors and warnings

setErrorStream(OutputStream, String)

Description

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.

Syntax

public final void setErrorStream(java.io.OutputStream out, java.lang.String enc)

Parameters

out - The output stream to use for errors and warnings

enc - the encoding to use

Throws

IOException - if an unsupported encoding is specified

setErrorStream(PrintWriter)

Description

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.

Syntax

public final void setErrorStream(java.io.PrintWriter out)

Parameters

out - The PrintWriter to use for errors and warnings

Throws

IOException - if I/O error occurs in setting the error stream.

setNodeFactory(NodeFactory)

Description

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.

Syntax

public void setNodeFactory(NodeFactory factory)

Parameters

factory - The NodeFactory to set

Throws

XMLParseException - if an invalid factory is set

See Also

NodeFactory

showWarnings(boolean)

Description

Switch to determine whether to print warnings.

Syntax

public void showWarnings(boolean flag)

Parameters

flag - determines whether warnings should be shown


DTD

Description of DTD

Implements the DOM DocumentType interface and holds the Document Type. Definition information for an XML document.

Syntax of DTD

public class DTD implements java.io.Externalizable
 
oracle.xml.parser.v2.DTD

Implemented Interfaces of DTD

java.io.Externalizable, java.io.Serializable

Constructors of DTD

DTD()

Description

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.

Syntax

public  DTD()

Methods of DTD

Table 11-12 Summary of Methods of DTD
Method Description

findElementDecl( String)

Finds an element declaration for the given tag name.

findEntity( String, boolean)

Finds a named entity in the DTD.

findNotation( String)

Retrieves the named notation from the DTD.

getChildNodes()

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.

getElementDecls()

A NamedNodeMap containing the element declarations in the DTD. Every node in this map is an ElementDecl object.

getEntities()

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.

getInternalSubset()

Gets the internal subset of the DTD

getName()

Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.

getNodeName()

Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.

getNodeType()

Gets a code representing the type of the underlying object

getNotations()

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.

getOwnerImplementation()

Gets the owner of the DTD implementation.

gtPublicId()

Gets The public identifier associated with the DTD, if specified. If the public identifier was not specified, this is null.

getRootTag()

Get the root tag for the DTD

getSystemId()

Gets the system identifier associated with the DTD, if specified. If the system identifier was not specified, this is null.

hasChildNodes()

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

normailize()

Normalize the DTD.

printExternalDTD( OutputStream)

Writes the contents of this document to the given output stream.

printExternalDTD( OutputStream, String)

Writes the contents of the external DTD to the given output stream.

printExternalDTD( PrintWriter)

Writes the contents of this document to the given output stream.

readExternal( ObjectInput)

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

setRootTag( String)

Set the root tag for the DTD

writeExternal( ObjectOutput)

This method saves the state of the object by creating a binray compressed stream with information about this object.

findElementDecl(String)

Description

Finds an element declaration for the given tag name.

Syntax

public final ElementDecl findElementDecl(java.lang.String name)

Parameters

name - The tag name.

Returns

the element declaration object.

findEntity(String, boolean)

Description

Finds a named entity in the DTD.

Syntax

public final org.w3c.dom.Entity findEntity(java.lang.String n, boolean par)

Parameters

n - The name of the entity.

par - Boolean indicating if the entitiy is parameter Entity.

Returns

The specified Entity object; returns null if it is not found.

findNotation(String)

Description

Retrieves the named notation from the DTD.

Syntax

public final org.w3c.dom.Notation findNotation(java.lang.String name)

RParameters

name - The name of the notation.

Returns

the Notation object; returns null if it is not found.

getChildNodes()

Description

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.

Syntax

public org.w3c.dom.NodeList getChildNodes()

Returns

The children of this node

getElementDecls()

Description

A NamedNodeMap containing the element declarations in the DTD. Every node in this map is an ElementDecl object.

Syntax

public org.w3c.dom.NamedNodeMap getElementDecls()

Returns

The element declarations in the DTD The DOM Level 1 does not support editing elementdecls, therefore elementdecls cannot be altered in any way.

getEntities()

Description

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.

Syntax

public org.w3c.dom.NamedNodeMap getEntities()

Returns

The entities declared in the DTD

getInternalSubset()

Description

Gets the internal subset of the DTD

Syntax

public java.lang.String getInternalSubset()

Returns

The internal subset declarations as a string

getName()

Description

Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.

Syntax

public java.lang.String getName()

Returns

Name of the DTD

getNodeName()

Description

Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.

Syntax

public java.lang.String getNodeName()

Returns

Name of the DTD

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getNotations()

Description

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.

Syntax

public org.w3c.dom.NamedNodeMap getNotations()

Returns

The notations declared in the DTD

getOwnerImplementation()

Description

Gets the owner of the DTD implementation.

Syntax

public XMLDOMImplementation getOwnerImplementation()

Returns

the Implementation this DTD was created from

Since

DOM 2

getPublicId()

Description

Gets The public identifier associated with the DTD, if specified. If the public identifier was not specified, this is null.

Syntax

public java.lang.String getPublicId()

Returns

the public identifier associated with the DTD

getRootTag()

Description

Get the root tag for the DTD

Syntax

public java.lang.String getRootTag()

Returns

root tag

getSystemId()

Description

Gets the system identifier associated with the DTD, if specified. If the system identifier was not specified, this is null.

Syntax

public java.lang.String getSystemId()

Returns

the system identifier associated with the DTD

hasChildNodes()

Description

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

Syntax

public boolean hasChildNodes()

Returns

false as DTD node can not have any children,

normalize()

Description

Normalize the DTD.

Syntax

public void normalize()

Since

DOM 2

printExternalDTD(OutputStream)

Description

Writes the contents of this document to the given output stream.

Syntax

public void printExternalDTD(java.io.OutputStream out)

Parameters

out - OutputStream to write to

Throws

IOException - if an error occurs

printExternalDTD(OutputStream, String)

Description

Writes the contents of the external DTD to the given output stream.

Syntax

public void printExternalDTD(java.io.OutputStream out, java.lang.String enc)

Writes the contents of the external DTD to the given output stream.

Parameters

out - OutputStream to write to

enc - Encoding to use for the output

Throws

IOException - if an invalid encoding was specified or if any other error occurs

printExternalDTD(PrintWriter)

Description

Writes the contents of this document to the given output stream.

Syntax

public void printExternalDTD(java.io.PrintWriter out)

Parameters

out - PrintWriter to write to

Throws

IOException - if an error occurs

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - the ObjectInput stream used for reading the compressed stream.

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found.

setRootTag(String)

Description

Set the root tag for the DTD

Syntax

public void setRootTag(java.lang.String root)

Parameters

root - the root tag

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binray compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

outArg - The ObjectOutput stream used to write the serialized/ compressed stream.

Throws

IOException - is thrown when there is an exception while writing the serialized/compressed stream.


ElementDecl

Description of ElementDecl

This class represents an element declaration in a DTD.

Syntax of ElementDecl

public class ElementDecl implements java.io.Serializable, java.io.Externalizable
 
oracle.xml.parser.v2.ElementDecl

Implemented Interfaces of ElementDecl

java.io.Externalizable, java.io.Serializable

Fields of ElementDecl

Table 11-13 Fields of ElementDecl
Field Syntax Description

ANY

public static final byte ANY

Element content type - Children can be any element

ASTERISK

public static final int ASTERISK

ContentModelParseTreeNode type - "*" node (has one children)

COMMA

public static final int COMMA

ContentModelParseTreeNode type - "," node (has two children)

ELEMENT

public static final int ELEMENT

ContentModelParseTreeNode type - 'leaf' node (has no children)

ELEMENT_DECLARED

ublic static final int ELEMENT_DECLARED

ELEMENTS

public static final byte ELEMENTS

Element content type - Children can be elements as per Content Model

EMPTY

public static final byte EMPTY

Element content type - No Children

ID_ATTR_DECL

public static final int ID_ATTR_DECL

MIXED

public static final byte MIXED

Element content type - Children can be PCDATA & elements as per Content Model

OR

public static final int OR

ContentModelParseTreeNode type - "|" node (has two children)

PLUS

public static final int PLUS

ContentModelParseTreeNode type - "+" node (has one children)

QMARK

public static final int QMARK

ContentModelParseTreeNode type - "?" node (has one children)


Constructors of ElementDecl

ElementDecl()

Description

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.

Syntax

public  ElementDecl()

Methods of ElementDecl

Table 11-14 Summary of Methods of ElementDecl
Method Description

cloneNode(boolean)

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.

expectedElements( Element)

Returns vector of element names that can be appended to the element.

findAttrDecl( String)

Gets an attribute declaration object or null if not found

getAttrDecls()

Gets an enumeration of attribute declarations

getContentElements()

Returns Vector of elements that can be appended to this element

getContentType()

Returns content model of element

getNodeName()

Gets the name of the Element Decl.

getNodeType()

Gets a code representing the type of the underlying object

getParseTree()

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.

readExternal( ObjectInput)

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

validateContent(Element)

Validates the content of a element node.

writeExternal( ObjectOutput)

This method saves the state of the object by creating a binray compressed stream with information about this object.

cloneNode(boolean)

Description

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.

Syntax

public org.w3c.dom.Node cloneNode(boolean deep)

Parameters

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).

Returns

The duplicate node.

expectedElements(Element)

Description

Returns vector of element names that can be appended to the element.

Syntax

public java.util.Vector expectedElements(org.w3c.dom.Element e)

Parameters

e - Element

Returns

Vector of names

findAttrDecl(String)

Description

Gets an attribute declaration object or null if not found

Syntax

public final AttrDecl findAttrDecl(java.lang.String name)

Parameters

name - Attribute declaration to find

Returns

The AttrDecl object, or null, if it was not found

getAttrDecls()

Description

Gets an enumeration of attribute declarations

Syntax

public org.w3c.dom.NamedNodeMap getAttrDecls()

Returns

An enumeration of attribute declarations

getContentElements()

Description

Returns Vector of elements that can be appended to this element

Syntax

public final java.util.Vector getContentElements()

Returns

The Vector containing the element names.

getContentType()

Description

Returns content model of element

Syntax

public int getContentType()

Returns

The type of the element declaration.

getNodeName()

Description

Gets the name of the Element Decl.

Syntax

public java.lang.String getNodeName()

Returns

name of the node

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

Type of the node

getParseTree()

Description

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.

Syntax

public final org.w3c.dom.Node getParseTree()

Returns

The Node containing the Content Model parse tree root node.

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

in - the ObjectInput stream used for reading the compressed stream.

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

validateContent(Element)

Description

Validates the content of a element node.

Syntax

public boolean validateContent(org.w3c.dom.Element e)

Returns

True if valid, else false

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binray compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

out - The ObjectOutput stream used to write the serialized/ compressed stream.

Throws

IOException - is thrown when there is an exception while writing the serialized/compressed stream.


NodeFactory

Description of NodeFactory

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.

Syntax of NodeFactory

public class NodeFactory extends java.lang.Object implements 
java.io.Serializable
 
java.lang.Object
  |
  +--oracle.xml.parser.v2.NodeFactory

Implemented Interfaces of NodeFactory

java.io.Serializable

See Also

DOMParser.setNodeFactory(NodeFactory)


Constructors of NodeFactory

NodeFactory()

Syntax

public  NodeFactory()

Methods of NodeFactory

Table 11-15 Summary of Methods of NodeFactory
Method Description

createAttribute( String, String)

Creates an attribute node with the specified tag, and text.

createAttribute( String, String, String, String)

Creates an attribute node with the specified tag, and text.

createCDATASection( String)

Creates a CDATA node with the specified text.

createComment( String)

Creates a comment node with the specified text.

createDocument()

Creates a document node. This method cannot return a null pointer.

createDocumentFragment()

Creates a document fragment node with the specified tag.

createElement( String)

Creates an Element node with the specified tag.

createElementNS( String, String, String)

Creates an Element node with the specified local name,prefix , namespaceURI

createEntityReference( String)

Creates an entity reference node with the specified tag.

createProcessingInstruction(String, String)

Creates a PI node with the specified tag, and text.

createTextNode(String)

Creates a text node with the specified text.

createAttribute(String, String)

Description

Creates an attribute node with the specified tag, and text.

Syntax

public XMLAttr createAttribute(java.lang.String tag, java.lang.String text)

Parameters

tag - The name of the node.

text - The text associated with the node.

Returns

The created attribute node.

createAttribute(String, String, String, String)

Description

Creates an attribute node with the specified tag, and text.

Syntax

public XMLAttr createAttribute(java.lang.String localName, java.lang.String 
prefix, java.lang.String namespaceURI, java.lang.String value)

Parameters

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.

Returns

The created attribute node.

createCDATASection(String)

Description

Creates a CDATA node with the specified text.

Syntax

public XMLCDATA createCDATASection(java.lang.String text)

Parameters

text - The text associated with the node.

Returns

The created CDATA node.

createComment(String)

Description

Creates a comment node with the specified text.

Syntax

public XMLComment createComment(java.lang.String text)

Parameters

text - The text associated with the node.

Returns

The created comment node.

createDocument()

Description

Creates a document node. This method cannot return a null pointer.

Syntax

public XMLDocument createDocument()

Returns

The created element.

createDocumentFragment()

Description

Creates a document fragment node with the specified tag.

Syntax

public XMLDocumentFragment createDocumentFragment()

Returns

The created document fragment node.

createElement(String)

Description

Creates an Element node with the specified tag.

Syntax

public XMLElement createElement(java.lang.String tag)

Parameters

tag - The name of the element.

Returns

The created element.

createElementNS(String, String, String)

Description

Creates an Element node with the specified local name,prefix , namespaceURI

Syntax

public XMLElement createElementNS(java.lang.String localName, java.lang.String 
prefix, java.lang.String namespaceURI)

Parameters

localName - the name of the element

prefix - the prefix of the element,

namespaceURI - the namespace of the element

Returns

The created element.

createEntityReference(String)

Description

Creates an entity reference node with the specified tag.

Syntax

public XMLEntityReference createEntityReference(java.lang.String tag)

Parameters

tag - The name of the node.

Returns

The created entity reference node.

createProcessingInstruction(String, String)

Description

Creates a PI node with the specified tag, and text.

Syntax

public XMLPI createProcessingInstruction(java.lang.String tag, java.lang.String 
text)

Parameters

tag - The name of the node.

text - The text associated with the node.

Returns

The created PI node.

createTextNode(String)

Description

Creates a text node with the specified text.

Syntax

public XMLText createTextNode(java.lang.String text)

Parameters

text - The text associated with the node.

Returns

The created text node.


oraxml

Description of oraxml

The oraxml class provides a command-line interface to validate XML files

Table 11-16 Command-line interface of oraxml
command description

-help

Prints the help message

-version

Prints the release version

-novalidate

Parses the input file to check for well-formedness

-dtd

Validates the input file with DTD validation

-schema

Validates the input file with Schema validation

-log <logfile>

Writes the errors/logs to the output file

-comp

Compresses the input xml file

-decomp

Decompresses the input compressed file

-enc

Prints the encoding of the input file

-warning

Show warnings

Syntax of oraxml

public class oraxml extends java.lang.Object
 
java.lang.Object
  |
  +--oracle.xml.parser.v2.oraxml


Constructors of oraxml

oraxml()

Syntax

public  oraxml()

Methods of oraxml

main(String[])

syntax

public static void main(java.lang.String[] args)

SAXAttrList

Description of SAXAttrList

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

Syntax of SAXAttrList

public class SAXAttrList
 
oracle.xml.parser.v2.SAXAttrList

Comments on 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.


Constructors of SAXAttrList

SAXAttrList(int)

Syntax

public  SAXAttrList(int elems)

Methods of SAXAttrList

addAttr(String, String, String, String, boolean, int)

Description

Add an attribute to the parent element node.

Syntax

public void addAttr(java.lang.String pfx, java.lang.String lname, 
java.lang.String tag, java.lang.String value, boolean spec, int type)

Parameters

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

addAttr(String, String, String, String, boolean, int, String)

Description

Add an attribute to the parent element node.

Syntax

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)

Parameters

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

getExpandedName(int)

Description

Get the expanded name for an attribute in the list (by position)

Syntax

public java.lang.String getExpandedName(int i)

Parameters

i - The index of the attribute in the list.

Returns

The expanded name for the attribute

getIndex(String)

Description

Look up the index of an attribute by XML 1.0 qualified name.

Syntax

public int getIndex(java.lang.String qName)

Parameters

qName - The qualified (prefixed) name.

Returns

The index of the attribute, or -1 if it does not appear in the list.

getIndex(String, String)

Description

Look up the index of an attribute by Namespace name.

Syntax

public int getIndex(java.lang.String uri, java.lang.String localPart)

Parameters

uri - The Namespace URI, or the empty string if the name has no Namespace URI.

localName - The attribute's local name.

Returns

The index of the attribute, or -1 if it does not appear in the list.

Since

SAX2

getLength()

Description

Return the number of attributes in this list.

Syntax

public int getLength()

Comments

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.

Returns

The number of attributes in the list.

getLocalName(int)

Look up an attribute's local name by index.

Description

Syntax

public java.lang.String getLocalName(int index)

Parameters

index - The attribute index (zero-based).

Returns

The local name, or the empty string if Namespace processing is not being performed, or null if the index is out of range.

Since

SAX2

See Also

getLength()

getPrefix(int)

Description

Get the namespace prefix for an attribute in the list (by position)

Syntax

public java.lang.String getPrefix(int i)

Parameters

i - The index of the attribute in the list.

Returns

The namespace prefix for the attribute

getQName(int)

Description

Look up an attribute's XML 1.0 qualified name by index.

Syntax

public java.lang.String getQName(int index)

Parameters

index - The attribute index (zero-based).

Returns

The XML 1.0 qualified name, or the empty string if none is available, or null if the index is out of range.

Since

SAX2

See Also

getLength()

getType(int)

Description

Look up an attribute's type by index.

Syntax

public java.lang.String getType(int index)

Comments

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".

Parameters

index - The attribute index (zero-based).

Returns

The attribute's type as a string, or null if the index is out of range.

See Also

getLength()

getType(String)

Description

Look up an attribute's type by XML 1.0 qualified name.

Syntax

public java.lang.String getType(java.lang.String qName)

Comments

See getType(int)  for a description of the possible types.

Parameters

qName - The XML 1.0 qualified name.

Returns

The attribute type as a string, or null if the attribute is not in the list or if qualified names are not available.

getType(String, String)

Description

Look up an attribute's type by Namespace name.

Syntax

public java.lang.String getType(java.lang.String uri, java.lang.String 
localName)

Comments

See getType(int)  for a description of the possible types.

Parameters

uri - The Namespace URI, or the empty String if the name has no Namespace URI.

localName - The local name of the attribute.

Returns

The attribute type as a string, or null if the attribute is not in the list or if Namespace processing is not being performed.

Since

SAX2

getURI(int)

Description

Look up an attribute's Namespace URI by index.

Syntax

public java.lang.String getURI(int index)

Parameters

index - The attribute index (zero-based).

Returns

The Namespace URI, or the empty string if none is available, or null if the index is out of range.

Since

SAX2

See Also

getLength()

getValue(int)

Description

Look up an attribute's value by index.

Syntax

public java.lang.String getValue(int index)

Description

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.

Parameters

index - The attribute index (zero-based).

Returns

The attribute's value as a string, or null if the index is out of range.

See Also

getLength()

getValue(String)

Description

Look up an attribute's value by XML 1.0 qualified name.

Syntax

public java.lang.String getValue(java.lang.String qName)

Comments

See getValue(int)  for a description of the possible values.

Parameters

qName - The XML 1.0 qualified name.

Returns

The attribute value as a string, or null if the attribute is not in the list or if qualified names are not available.

getValue(String, String)

Description

Look up an attribute's value by Namespace name.

Syntax

public java.lang.String getValue(java.lang.String uri, java.lang.String 
localName)

Comments

See getValue(int)  for a description of the possible values.

Parameters

uri - The Namespace URI, or the empty String if the name has no Namespace URI.

localName - The local name of the attribute.

Returns

The attribute value as a string, or null if the attribute is not in the list.

Since

SAX2

reset()

Description

Resets the SAXAttrList

Syntax

public void reset()

SAXParser

Syntax

public class SAXParser
 
oracle.xml.parser.v2.SAXParser

Description

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:


Constructors

SAXParser()

Description

Creates a new parser object.

Syntax

public  SAXParser()

Methods

getContentHandler()

Description

Return the current content handler.

Syntax

public org.xml.sax.ContentHandler getContentHandler()

Returns

The current content handler, or null if none has been registered.

Since

SAX 2.0

See Also

setContentHandler(ContentHandler)

getDTDHandler()

Description

Return the current DTD handler.

Syntax

public org.xml.sax.DTDHandler getDTDHandler()

Returns

The current DTD handler, or null if none has been registered.

Since

SAX 2.0

See Also

setDTDHandler(DTDHandler)

getFeature(String)

Description

Look up the value of a feature.

Syntax

public boolean getFeature(java.lang.String name)

Comments

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.

Parameters

feature - Name of the feature, which is a fully-qualified URI.

version - Version of the feature.

Returns

The current state of the feature (true or false).

Throws

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.

See Also

setFeature(String, boolean)

getProperty(String)

Description

Look up the value of a property.

Syntax

public java.lang.Object getProperty(java.lang.String name)

Comments

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.

Parameters

name - The property name, which is a fully-qualified URI.

Returns

The current value of the property.

Throws

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.

See Also

setProperty(String, Object)

setContentHandler(ContentHandler)

Description

Allow an application to register a content event handler.

Syntax

public void setContentHandler(org.xml.sax.ContentHandler handler)

Comments

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.

Parameters

handler - The content handler.

Throws

java.lang.NullPointerException - If the handler argument is null.

Since

SAX 2.0

See Also

getContentHandler()

setDTDHandler(DTDHandler)

Description

Allow an application to register a DTD event handler.

Syntax

public void setDTDHandler(org.xml.sax.DTDHandler handler)

Comments

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.

Parameters

handler - The DTD handler.

Throws

java.lang.NullPointerException - If the handler argument is null.

See Also

getDTDHandler()

setFeature(String, boolean)

Description

Set the state of a feature.

Syntax

public void setFeature(java.lang.String name, boolean value)

Comments

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

Parameters

name - The feature name, which is a fully-qualified URI.

state - The requested state of the feature (true or false).

Throws

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.

See Also

getFeature(String)

setProperty(String, Object)

Description

Set the value of a property.

Syntax

public void setProperty(java.lang.String name, java.lang.Object value)

Comments

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.

Parameters

name - The property name, which is a fully-qualified URI.

state - The requested value for the property.

Throws

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.


XMLAttr

Syntax of XMLAttr

public class XMLAttr implements oracle.xml.parser.v2.NSName, 
java.io.Externalizable
 
oracle.xml.parser.v2.XMLAttr

Implemented Interfaces of XMLAttr

java.io.Externalizable, NSName, oracle.xml.util.NSName, java.io.Serializable

Description

This class implements the DOM Attr interface and holds information on each attribute of an element.

See Also

Attr, NodeFactory, DOMParser.setNodeFactory(NodeFactory)

XMLAttr()

Description

Default constructor.

Syntax

public  XMLAttr()

Comments

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

XMLAttr(String, String)

Description

Construct attribute with given name and value.

Syntax

public  XMLAttr(java.lang.String n, java.lang.String v)

Comments

Deprecated; use createAttribute(String) method of XMLDocument

Parameters

n - Name of the attribute

v - Value of the attribute

XMLAttr(String, String, String, String)

Description

Namespace support

Syntax

public  XMLAttr(java.lang.String name, java.lang.String prefix, java.lang.String 
namespace, java.lang.String v)

Comments

Deprecated; use createAttributeNS(String, String) method of XMLDocument

Parameters

name - Local name of the attribute

prefix - Prefix of the attribute

namespace - Namespace of the attribute

v - Value of the attribute

XMLAttr(String, String, String, String, String)

Description

private constructor (doesn't intern names)

Syntax

public  XMLAttr(java.lang.String name, java.lang.String prefix, java.lang.String 
qname, java.lang.String namespace, java.lang.String v)

Comments

Deprecated; use crateAttribute(String) or createAttributeNS(String, String) of XMLDocument

Parameters

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


Methods

addText(String)

Description

Syntax

public XMLNode addText(java.lang.String str)

cloneNode(boolean)

Description

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

Syntax

public org.w3c.dom.Node cloneNode(boolean deep)

Comments

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.

Parameters

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).

Returns

The duplicate node.

getExpandedName()

Description

Gets the fully resolved Name for this attribute

Syntax

public java.lang.String getExpandedName()

Specified By

oracle.xml.util.NSName.getExpandedName() in interface oracle.xml.util.NSName

Returns

the fully resolved Name

getLocalName()

Description

Gets the local name of this attribute

Syntax

public java.lang.String getLocalName()

Specified By

oracle.xml.util.NSName.getLocalName() in interface oracle.xml.util.NSName

Returns

the local Name for this attribute

Since

DOM 2

getName()

Description

Gets the attribute name.

Syntax

public java.lang.String getName()

Returns

attribute name

getNamespaceURI()

Description

Gets the namespace of the attribute

Syntax

public java.lang.String getNamespaceURI()

Returns

the namespace URI associated with this attribute

Since

DOM 2

getNextAttribute()

Description

Gets the next attribute if any

Syntax

public XMLAttr getNextAttribute()

Returns

the next attribute

getNextSibling()

Description

Syntax

public org.w3c.dom.Node getNextSibling()

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getNodeValue()

Description

Gets the value of this node, depending on its type

Syntax

public java.lang.String getNodeValue()

Returns

Value of this node

Throws

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.

getOwnerElement()

Description

Gets the element which owns this attribute

Syntax

public org.w3c.dom.Element getOwnerElement()

Returns

the element node that owns this attribute

Since

DOM 2

getParentNode()

Description

Gets the parent of this node.

Syntax

public org.w3c.dom.Node getParentNode()

Comments

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.

Returns

The parent of this node

getPrefix()

Description

Gets the name space prefix of the element

Syntax

public java.lang.String getPrefix()

Specified By

oracle.xml.util.NSName.getPrefix() in interface oracle.xml.util.NSName

Returns

the namespace prefix for this attribute

Since

DOM 2

getPreviousSibling()

Description

Syntax

public org.w3c.dom.Node getPreviousSibling()

getSpecified()

Description

Returns true if the attribute was specified explicity in the element

Syntax

public boolean getSpecified()

Returns

true, if the attribute was specified explicitly, false, if it was not

getValue()

Description

Gets the attribute value.

Syntax

public java.lang.String getValue()

Returns

attribute value

readExternal(ObjectInput)

Description

This method restores the information written by writeExternal.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - is the ObjectInput stream used to read the compressed stream

Throws

IOException - is thrown when there is an exception while reading the compressed stream.

ClassNotFoundException - is thrown when the class is not found

setNodeValue(String)

Description

Sets the value of this node, depending on its type

Syntax

public void setNodeValue(java.lang.String nodeValue)

Parameters

nodeValue - the value of thenode to be set

Throws

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.

setValue(String)

Description

Sets the value.

Syntax

public void setValue(java.lang.String arg)

Parameters

arg - Value to set

writeExternal(ObjectOutput)

Description

This method saves the state of the object. The object information is saved in a binary compressed stream.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

outArg - The ObjectOutput stream used to write the compressed stream

Throws

IOException - is thrown when there is an exception while writing the compressed stream.


XMLCDATA

Description

This class implements the DOM CDATASection interface.

Syntax

public class XMLCDATA implements java.io.Externalizable
 
oracle.xml.parser.v2.XMLCDATA

Implemented Interfaces

java.io.Externalizable, java.io.Serializable

See Also

CDATASection, NodeFactory, DOMParser.setNodeFactory(NodeFactory)


Constructors

XMLCDATA()

Description

Default constructor.

Syntax

public  XMLCDATA()

Comments

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.


Methods

getNodeName()

Description

Gets a name of the node

Syntax

public java.lang.String getNodeName()

Returns

name of the node

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - The ObjectInput stream used for reading the compressed stream

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

outArg - is the ObjectOutput stream used to write the compressed stream.

Throws

IOException - is thrown when there is an exception while writing the compressed stream.


XMLComment

Description

This class implements the DOM Comment interface.

Syntax

public class XMLComment implements java.io.Externalizable
 
oracle.xml.parser.v2.XMLComment

Implemented Interfaces

java.io.Externalizable, java.io.Serializable

See Also

Comment, NodeFactory, DOMParser.setNodeFactory(NodeFactory)


Constructors

XMLComment()

Description

Default constructor.

Syntax

public  XMLComment()

Comments

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.


Methods

addText(String)

Description

Adds the comment text

Syntax

public XMLNode addText(java.lang.String str)

Parameters

str - the comment text

getNodeName()

Description

Gets a name of the node

Syntax

public java.lang.String getNodeName()

Returns

name of the node

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - The ObjectInput stream used for reading the compressed stream

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

reportSAXEvents(ContentHandler)

Description

Report SAX Events from a DOM Tree

Syntax

public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)

Parameters

ContentHandler - cntHandler

Throws

SAXException - thrown by SAX Callback functions

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

outArg - is the ObjectOutput stream used to write the compressed stream.

Throws

IOException - is thrown when there is an exception while writing the compressed stream.


XMLDeclPI

Description

This class implements the XML Decl Processing Instruction.

Syntax

public class XMLDeclPI extends oracle.xml.parser.v2.XMLPI implements 
java.io.Externalizable
 
oracle.xml.parser.v2.XMLPI
  |
  +--oracle.xml.parser.v2.XMLDeclPI

Implemented Interfaces

java.io.Externalizable, java.io.Serializable

See Also

ProcessingInstruction


Constructors

XMLDeclPI()

Description

Syntax

public  XMLDeclPI()

XMLDeclPI(String, String, String, boolean)

Description

Syntax

public  XMLDeclPI(java.lang.String version, java.lang.String encoding, 
java.lang.String standalone, boolean textDecl)

Methods

cloneNode(boolean)

Description

Returns a duplicate of this node, i.e., serves as a generic copy

Syntax

public org.w3c.dom.Node cloneNode(boolean deep)

Returns

The duplicate node.

getData()

Description

Returns the fully constructed string 'version=1.0 ....'

Syntax

public java.lang.String getData()

Returns

the nodevalue

Throws

DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

getEncoding()

Description

Retrieves the character encoding information.

Syntax

public final java.lang.String getEncoding()

Returns

the encoding information stored in the <?xml ...?> tag or the user-defined output encoding if it has been more recently set.

getNodeValue()

Description

Gets the value of this node

Syntax

public java.lang.String getNodeValue()

Returns

the nodevalue

Throws

DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation

getStandalone()

Description

Retrieves the standalone information.

Syntax

public final java.lang.String getStandalone()

Returns

the standalone attribute stored in the <?xml ...?> tag.

getVersion()

Description

Retrieves the version information.

Syntax

public final java.lang.String getVersion()

Returns

the version number stored in the <?xml ...?> tag.

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Overrides

XMLPI.readExternal(ObjectInput) in class XMLPI

Parameters

inArg - The ObjectInput stream used for reading the compressed stream

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

setEncoding(String)

Description

Sets the character encoding for output.

Syntax

public final void setEncoding(java.lang.String encoding)

Comments

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.

Parameters

encoding - The character encoding to set

setStandalone(String)

Description

Sets the standalone information stored in the <?xml ...?> tag.

Syntax

public final boolean setStandalone(java.lang.String value)

Parameters

value - The attribute value ('yes' or 'no').

setVersion(String)

Description

Sets the version number stored in the <?xml ...?> tag.

Syntax

public final void setVersion(java.lang.String version)

Parameters

version - The version information to set.

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Overrides

XMLPI.writeExternal(ObjectOutput) in class XMLPI

Parameters

outArg - is the ObjectOutput stream used to write the compressed stream.

Throws

IOException - is thrown when there is an exception while writing the compressed stream.


XMLDocument

Description

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.

Syntax

public class XMLDocument implements java.io.Externalizable
 
oracle.xml.parser.v2.XMLDocument

Implemented Interfaces

java.io.Externalizable, java.io.Serializable

Comments

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.


Constructors

XMLDocument()

Description

Creates an empty document.

Syntax

public  XMLDocument()

Methods

addID(String, XMLElement)

Description

Add a ID Element associated with this document

Syntax

public void addID(java.lang.String name, XMLElement e)

Parameters

id - String - id value

e - XMLElement associated with id

adoptNode(Node)

Description

Adopts a node from another document to this document.

Syntax

public org.w3c.dom.Node adoptNode(org.w3c.dom.Node srcNode)

Comments

The returned node has no parent; (parentNode is null). The source node is removed from the original document;

Parameters

Node - to be adopted

Returns

Node with document association updated

Throws

DOMException - NOT_SUPPORTED_ERR: Raised if the type of the node being adopted is not supported.

Since

DOM 2

appendChild(Node)

Description

Appends a new node to the document

Syntax

public org.w3c.dom.Node appendChild(org.w3c.dom.Node elem)

Parameters

the - new node to be added

Returns

the node after appending it to the document

Throws

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.

cloneNode(boolean)

Description

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

Syntax

public org.w3c.dom.Node cloneNode(boolean deep)

Comments

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.

Parameters

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).

Returns

The duplicate node.

createAttribute(String)

Description

Creates an Attr of the given name.

Syntax

public org.w3c.dom.Attr createAttribute(java.lang.String name)

Comments

Note that the Attr instance can then be set on an Element using the setAttribute method.

Parameters

name - The name of the attribute.

Returns

A new Attr object.

Throws

DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createAttributeNS(String, String)

Description

Creates an attribute with the given qualified name and namespace URI.

Syntax

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, 
java.lang.String qualifiedName)

Parameters

namespaceURI - namespace of the attribute/element to be created

qualifiedName - qualified name of the attribute/element to be created

Returns

Element node with given qualified name and namespace URI

Throws

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/"

Since

DOM 2

createCDATASection(String)

Description

Creates a CDATASection node whose value is the specified string.

Syntax

public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)

Parameters

data - The data for the CDATASection contents.

Returns

The new CDATASection object.

Throws

DOMException - A DOMException could be thrown.

createComment(String)

Description

Creates a Comment node given the specified string.

Syntax

public org.w3c.dom.Comment createComment(java.lang.String data)

Parameters

data - The data for the node.

Returns

The new Comment object.

createDocumentFragment()

Description

Creates an empty DocumentFragment object.

Syntax

public org.w3c.dom.DocumentFragment createDocumentFragment()

Returns

A new DocumentFragment.

createElement(String)

Description

Creates an element of the type specified.

Syntax

public org.w3c.dom.Element createElement(java.lang.String tagName)

Comments

Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.

Parameters

tagName - The name of the element type to instantiate. The name is treated as case-sensitive.

Returns

A new Element object.

Throws

DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createElementNS(String, String)

Description

Creates an element of the given qualified name and namespace URI.

Syntax

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, 
java.lang.String qualifiedName)

Parameters

namespaceURI - namespace of the attribute/element to be created

qualifiedName - qualified name of the attribute/element to be created

Returns

Element node with given qualified name and namespace URI

Throws

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"

Since

DOM 2

createEntityReference(String)

Description

Creates an EntityReference object.

Syntax

public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)

Parameters

name - The name of the entity to reference.

Returns

The new EntityReference object.

Throws

DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createEvent(String)

Description

Creates an event object of the specified type

Syntax

public org.w3c.dom.events.Event createEvent(java.lang.String type)

Parameters

type - the type of the event

Returns

Event object of the specified type

createMutationEvent(String)

Description

Creates a Mutation Event object of specified type

Syntax

public org.w3c.dom.events.MutationEvent createMutationEvent(java.lang.String 
type)

Parameters

type - the type of the mutation event

Returns

Event object of the specified type

createNodeIterator(Node, int, NodeFilter, boolean)

Description

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

Syntax

public org.w3c.dom.traversal.NodeIterator createNodeIterator(org.w3c.dom.Node 
root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean 
expandEntityReferences)

Parameters

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.

Returns

object that implements NodeIterator interface,created on this document

Throws

DOMException - NOT_SUPPORTED_ERR: if the NodeIterator could not be created with specified root

createProcessingInstruction(String, String)

Description

Creates a ProcessingInstruction node given the specified name and data strings.

Syntax

public org.w3c.dom.ProcessingInstruction 
createProcessingInstruction(java.lang.String target, java.lang.String data)

Parameters

target - The target part of the processing instruction.

data - The data for the node.

Returns

The new ProcessingInstruction object.

Throws

DOMException - INVALID_CHARACTER_ERR: Raised if an invalid character is specified.

createRange()

Description

Create a new Document Range Object ,with Start and End Boundary points at the begining of the document.

Syntax

public org.w3c.dom.ranges.Range createRange()

Returns

new Range object with start and end boundary points at the begining of the document

createRangeEvent(String)

Description

Creates a Range Event object of specified type

Syntax

public org.w3c.dom.events.Event createRangeEvent(java.lang.String type)

Parameters

type - the type of the event

Returns

Event object of the specified type

createTextNode(String)

Description

Creates a Text node given the specified string.

Syntax

public org.w3c.dom.Text createTextNode(java.lang.String data)

Parameters

data - The data for the node.

Returns

The new Text object.

createTraversalEvent(String)

Description

Creates a Traversal Event object of specified type

Syntax

public org.w3c.dom.events.Event createTraversalEvent(java.lang.String type)

Parameters

type - the type of the event

Returns

Event object of the specified type

createTreeWalker(Node, int, NodeFilter, boolean)

Description

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

Syntax

public org.w3c.dom.traversal.TreeWalker createTreeWalker(org.w3c.dom.Node root, 
int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean 
expandEntityReferences)

Parameters

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

Returns

an object that implements TreeWalker interface,created on this document

Throws

DOMException - NOT_SUPPORTED_ERR: if the NodeIterator could not be created with specified root

expectedElements(Element)

Description

Returns vector of element names that can be appended to the element.

Syntax

public java.util.Vector expectedElements(org.w3c.dom.Element e)

Parameters

e - Element

Returns

Vector of names

getColumnNumber()

Description

Get column number debug information

Syntax

public int getColumnNumber()

Returns

column the column number

getDebugMode()

Description

Get the debug flag

Syntax

public boolean getDebugMode()

Returns

boolean flag

getDoctype()

Description

The Document Type Declaration (DTD) associated with this document. For XML documents without a DTD, this returns null.

Syntax

public org.w3c.dom.DocumentType getDoctype()

Comments

Note that the DOM Level 1 specification does not support editing the DTD.

Returns

The associated DTD

See Also

org.w3c.dom.DocumentType

getDocumentElement()

Description

This is a convenience attribute that allows direct access to the child node that is the root element of the document.

Syntax

public org.w3c.dom.Element getDocumentElement()

Returns

The root element

getElementById(String)

Description

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.

Syntax

public org.w3c.dom.Element getElementById(java.lang.String elementId)

Parameters

String - elementId used to get the matching Id Element

Returns

The matching Id Element if one exists or null if none exists

Since

DOM 2

getElementsByTagName(String)

Description

Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.

Syntax

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)

Parameters

tagname - The name of the tag to match on. The special value "*" matches all tags.

Returns

A new NodeList object containing all the matched Elements.

getElementsByTagNameNS(String, String)

Description

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.

Syntax

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String 
namespaceURI, java.lang.String localName)

Parameters

namespaceURI - namespace of the elements requested.

localName - local name of the element requested.

Returns

nodelist of matching elements

Since

DOM 2

getEncoding()

Description

Retrieves the character encoding information.

Syntax

public final java.lang.String getEncoding()

Returns

the encoding information stored in the <?xml ...?> tag or the user-defined output encoding if it has been more recently set.

getIDHashtable()

Description

Get the ID element hashtable in the XML DOM Tree

Syntax

public java.util.Hashtable getIDHashtable()

Returns

Hashtable - associated with XMLDocument

getImplementation()

Description

The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.

Syntax

public org.w3c.dom.DOMImplementation getImplementation()

Returns

The associated DOM implementation.

getLineNumber()

Description

Get line number debug information

Syntax

public int getLineNumber()

Returns

line the line number

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getOwnerDocument()

Description

The Document object associated with this node. Since this node is a Document this is null.

Syntax

public org.w3c.dom.Document getOwnerDocument()

Returns

null

getStandalone()

Description

Retrieves the standalone information.

Syntax

public final java.lang.String getStandalone()

Returns

the standalone attribute stored in the <?xml ...?> tag.

getSystemId()

Description

Get the system id of the entity contain this node

Syntax

public java.lang.String getSystemId()

Returns

sysid the system id

getText()

Description

Returns the non-marked-up text contained by this element.

Syntax

public java.lang.String getText()

Comments

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".

Returns

Non-marked-up text contained by the element.

getVersion()

Description

Retrieves the version information.

Syntax

public final java.lang.String getVersion()

Returns

the version number stored in the <?xml ...?> tag.

importNode(Node, boolean)

Description

Imports a node from another document to this document.

Syntax

public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)

Comments

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.

Parameters

Node - to be imported ,boolean variable indicating whether the descendants of this node are to be imported

Returns

A copy of the importedNode which is attached to the current document but not a part of the document tree

Throws

DOMException - NOT_SUPPORTED_ERR: Raised if the type of the node being imported is not supported.

Since

DOM 2

insertBefore(Node, Node)

Description

Inserts the node newChild before the existing child node refChild.

Syntax

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node 
refChild)

Comments

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.

Parameters

newChild - The node to insert.

refChild - The reference node, i.e., the node before which the new node must be inserted.

Returns

The node being inserted.

Throws

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.

print(OutputStream)

Description

Writes the contents of this document to the given output stream.

Syntax

public void print(java.io.OutputStream out)

Parameters

out - OutputStream to write to

Throws

IOException - if an error occurs

print(OutputStream, String)

Description

Writes the contents of this document to the given output stream.

Syntax

public void print(java.io.OutputStream out, java.lang.String enc)

Parameters

out - OutputStream to write to

enc - Encoding to use for the output

Throws

IOException - if an invalid encoding was specified or if any other error occurs

print(PrintDriver)

Description

Writes the contents of this document to the given output stream.

Syntax

public void print(PrintDriver pd)

Parameters

pd - PrintDriver used to write each node

Throws

IOException - if an error occurs

print(PrintWriter)

Description

Writes the contents of this document to the given output stream.

Syntax

public void print(java.io.PrintWriter out)

Parameters

out - PrintWriter to write to

Throws

IOException - if an error occurs

printExternalDTD(OutputStream)

Description

Writes the contents of this document to the given output stream.

Syntax

public void printExternalDTD(java.io.OutputStream out)

Parameters

out - OutputStream to write to

Throws

IOException - if an error occurs

printExternalDTD(OutputStream, String)

Description

Writes the contents of the external DTD to the given output stream.

Syntax

public void printExternalDTD(java.io.OutputStream out, java.lang.String enc)

Parameters

out - OutputStream to write to

enc - Encoding to use for the output

Throws

IOException - if an invalid encoding was specified or if any other error occurs

printExternalDTD(PrintWriter)

Description

Writes the contents of this document to the given output stream.

Syntax

public void printExternalDTD(java.io.PrintWriter out)

Parameters

out - PrintWriter to write to

Throws

IOException - if an error occurs

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - the ObjectInput stream used for reading the compressed stream

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

removeChild(Node)

Description

removes the elem from this documents list of child nodes

Syntax

public org.w3c.dom.Node removeChild(org.w3c.dom.Node elem)

Parameters

the - node to be removed

Returns

the node after its removed from the document

Throws

DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this document is readonly. NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

replaceChild(Node, Node)

Description

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

Syntax

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node 
oldChild)

Comments

If the newChild is already in the tree, it is first removed. This is an override of the XMLNode.removeChild method

Parameters

newChild - The new node to put in the child list.

oldChild - The node being replaced in the list.

Returns

The node replaced.

Throws

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.

reportSAXEvents(ContentHandler)

Description

Report SAX Events from a DOM Tree

Syntax

public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)

Parameters

ContentHandler - cntHandler

Throws

SAXException - thrown by SAX Callback functions

setDoctype(String, String, String)

Description

Sets the doctype URI for the document

Syntax

public void setDoctype(java.lang.String rootname, java.lang.String sysid, 
java.lang.String pubid)

Parameters

root - The name of the root element

sysid - The system id of the doctype

pubid - The public id of the doctype (can be null)

setEncoding(String)

Description

Sets the character encoding for output. Eventually it sets the ENCODING stored in the <?xml ...?> tag, but not until the document is saved.

Syntax

public final void setEncoding(java.lang.String encoding)

Comments

You should not call this method until the Document has been loaded.

Parameters

encoding - The character encoding to set

setLocale(Locale)

Description

Sets the locale for error reporting

Syntax

public final void setLocale(java.util.Locale locale)

Parameters

locale - Locale for error reporting.

setNodeContext(NodeContext)

Description

Syntax

public void setNodeContext(oracle.xml.util.NodeContext nctx)

setParsedDoctype(String, String, String)

Description

Sets the doctype object by parsing sysid

Syntax

public void setParsedDoctype(java.lang.String rootname, java.lang.String sysid, 
java.lang.String pubid)

Parameters

root - The name of the root element

sysid - The system id of the doctype

pubid - The public id of the doctype (can be null)

setStandalone(String)

Description

Sets the standalone information stored in the <?xml ...?> tag.

Syntax

public final void setStandalone(java.lang.String value)

Parameters

value - The attribute value ('yes' or 'no').

setVersion(String)

Description

Sets the version number stored in the <?xml ...?> tag.

Syntax

public final void setVersion(java.lang.String version)

Parameters

version - The version information to set.

validateElementContent(Element)

Description

Validates the content of a element node.

Syntax

public boolean validateElementContent(org.w3c.dom.Element e)

Parameters

e - Element to be validated

Returns

True if valid, else false

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

outArg - The ObjectOutput stream used to write the serialized/ compressed stream.

Throws

IOException - is thrown when there is an exception while writing the serialized/compressed stream.


XMLDocumentFragment

Description

This class implements the DOM DocumentFragment interface.

Syntax

public class XMLDocumentFragment implements java.io.Serializable
 
oracle.xml.parser.v2.XMLDocumentFragment

Implemented Interfaces

java.io.Serializable

Comments

Extends XMLElement rather than XMLNode so it can be handled as an element. This is convenient in processing

See Also

DocumentFragment, NodeFactory, DOMParser.setNodeFactory(NodeFactory)


Constructors

XMLDocumentFragment()

Description

Creates an empty document fragment

Syntax

public  XMLDocumentFragment()

Comments

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.


Methods

getAttributes()

Description

Syntax

public org.w3c.dom.NamedNodeMap getAttributes()

Returns

An empty NamedNodeMap.

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getParentNode()

Description

Gets the parent of this node

Syntax

public org.w3c.dom.Node getParentNode()

Returns

The parent of this node (always null)


XMLDOMException

Description

This class is used to throw DOM exceptions.

Syntax

public class XMLDOMException
 
oracle.xml.parser.v2.XMLDOMException


Constructors

XMLDOMException(short)

Description

Constructs a XMLDOMException exception with a specified message and a code.

Syntax

public  XMLDOMException(short code)

Parameters

code - Code indicated in DOM interface, uses default message

err - XMLError used for locale information

XMLDOMException(short, String)

Description

Constructs a XMLDOMException exception with a specified message and a code.

Syntax

public  XMLDOMException(short code, java.lang.String s)

Parameters

code - Code indicated in DOM interface, uses default message


XMLDOMImplementation

Description

This class implements the DOMImplementation

Syntax

public class XMLDOMImplementation implements java.io.Serializable
 
oracle.xml.parser.v2.XMLDOMImplementation

Implemented Interfaces

java.io.Serializable

Constructors

XMLDOMImplementation()

Description

Syntax

public  XMLDOMImplementation()

Methods

createDocument(String, String, DocumentType)

Description

Creates an XMLDocument object containing the specified DocumentType Node and a root element with the specified names and the empty DocumentType node.

Syntax

public org.w3c.dom.Document createDocument(java.lang.String namespaceURI, 
java.lang.String qualifiedName, org.w3c.dom.DocumentType doctype)

Parameters

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.

Returns

The Document object created.

Throws

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.

createDocumentType(String, String, String)

Description

Creates an empty DocumentType node with root element name, and system/public identifier.

Syntax

public org.w3c.dom.DocumentType createDocumentType(java.lang.String 
qualifiedName, java.lang.String publicId, java.lang.String systemId)

Parameters

qualifiedName - Qualified name of the root element.

systemid - System identifier of the DocumentType node.

publicid - Public identifier of the DocumentType node.

Returns

the DocumentType object created.

Throws

DOMException - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character NAMESPACE_ERR: Raised if the qualifiedName is malformed.

hasFeature(String, String)

Description

Test if the DOM implementation implements a specific feature.

Syntax

public boolean hasFeature(java.lang.String feature, java.lang.String version)

Returns

TRUE if the feature is implemented, FALSE alse otherwise

setFeature(String)

Description

Sets a specified feature.

Syntax

public void setFeature(java.lang.String feature)

Parameters

feature - the DOM feature

Throws

DOMException - if the feature could not be set.


XMLElement

Syntax

public class XMLElement implements oracle.xml.parser.v2.NSName, 
oracle.xml.parser.v2.NSResolver, java.io.Externalizable
 
oracle.xml.parser.v2.XMLElement

Implemented Interfaces:

java.io.Externalizable, NSName, oracle.xml.util.NSName, NSResolver, 
java.io.Serializable

Description

This class implements the DOM Element Interface


Constructors

XMLElement()

Description

Default constructor.

Syntax

public  XMLElement()

Comments

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.


Methods

cloneNode(boolean)

Description

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

Syntax

public org.w3c.dom.Node cloneNode(boolean deep)

Comments

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.

Parameters

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).

Returns

The duplicate node.

getAttribute(String)

Description

Retrieves an attribute value by name.

Syntax

public java.lang.String getAttribute(java.lang.String name)

Parameters

name - The name of the attribute to retrieve.

Returns

The Attr value as a string, or the empty string if that attribute does not have a specified or default value.

getAttributeNode(String)

Description

Retrieves an Attr node by name.

Syntax

public org.w3c.dom.Attr getAttributeNode(java.lang.String name)

Parameters

name - The name of the attribute to retrieve.

Returns

The Attr node with the specified attribute name or null if there is no such attribute.

getAttributeNodeNS(String, String)

Description

Syntax

public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI, 
java.lang.String localName)

Parameters

String - namespaceURI ,String localName of the attribute to be retrieved

Returns

Attribute with the given namespaceURI and localName if it exists, else null.

Since

DOM 2 Retrieves an Attr node by local name and namespace URI.

getAttributeNS(String, String)

Description

Syntax

public java.lang.String getAttributeNS(java.lang.String namespaceURI, 
java.lang.String localName)

Parameters

namespaceURI - namespace of the attribute requested.

localName - local name of the attribute requested.

Returns

the value of the attribute with the above mentioned namespace URI and localName if it exists ,else null.

Since

DOM 2 Retrieves an attribute value by local name and namespace URI.

getAttributes()

Description

A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.

Syntax

public org.w3c.dom.NamedNodeMap getAttributes()

Returns

The list of attributes of this element

getChildrenByTagName(String)

Description

Returns a NodeList of all immediate children with a given tag name,

Syntax

public org.w3c.dom.NodeList getChildrenByTagName(java.lang.String name)

Parameters

name - The name of the tag to match on.

Returns

A list of matching children

getChildrenByTagName(String, String)

Description

Returns a NodeList of all immediate children with a given tag name and namespace

Syntax

public org.w3c.dom.NodeList getChildrenByTagName(java.lang.String name, 
java.lang.String ns)

Parameters

name - The name of the tag to match on. (should be local name)

ns - The name space

Returns

A list of matching children

getElementsByTagName(String)

Description

Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.

Syntax

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)

Parameters

tagname - The name of the tag to match on. The special value "*" matches all tags.

Returns

A new NodeList object containing all the matched Elements.

getElementsByTagNameNS(String, String)

Description

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.

Syntax

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String 
namespaceURI, java.lang.String localName)

Parameters

namespaceURI - the namespace of the element

localName - the local name of the element

Since

DOM 2

getExpandedName()

Description

Get the fully resolved name for this element.

Syntax

public java.lang.String getExpandedName()

Specified By

oracle.xml.util.NSName.getExpandedName() in interface oracle.xml.util.NSName

Returns

the fully resolved name

getFirstAttribute()

Description

Retrieves the first Attr.

Syntax

public XMLNode getFirstAttribute()

Returns

The first Attr node null if there is no attribute.

getLocalName()

Description

Gets the local Name for this element.

Syntax

public java.lang.String getLocalName()

Specified By

oracle.xml.util.NSName.getLocalName() in interface oracle.xml.util.NSName

Returns

the local Name

getNamespaceURI()

Description

Gets the name space URI of this element

Syntax

public java.lang.String getNamespaceURI()

Returns

the namespace URI of this element

Since

DOM 2

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getPrefix()

Description

Get the namespace prefix for this element.

Syntax

public java.lang.String getPrefix()

Specified By

oracle.xml.util.NSName.getPrefix() in interface oracle.xml.util.NSName

Returns

the namespace prefix

getQualifiedName()

Description

Get the qualified name for this element.

Syntax

public java.lang.String getQualifiedName()

Specified By

oracle.xml.util.NSName.getQualifiedName() in interface oracle.xml.util.NSName

Returns

the qualified name

getTagName()

Description

Gets the name of the element.

Syntax

public java.lang.String getTagName()

Comments

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.

Returns

The element name

hasAttribute(String)

Description

Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.

Syntax

public boolean hasAttribute(java.lang.String name)

Parameters

String - name of the attribute whose presence is checked

Returns

true if the attribute whith the specified name is present, else null

Since

DOM 2

hasAttributeNS(String, String)

Description

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

Syntax

public boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String 
localName)

Parameters

namespaceURI - namespace of the attribute whose presence is checked

localName - local name of the attribute whose presence is checked

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

Since

DOM 2

hasAttributes()

Description

Returns whether this node (if it is an element) has any attributes.

Syntax

public boolean hasAttributes()

Returns

true if this node has any attributes, false otherwise.

Since

DOM Level 2

normalize()

Description

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.

Syntax

public void normalize()

Comments

Deprecated as of DOM 2

See Also

XMLNode.normalize()

readExternal(ObjectInput)

Description

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.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - is the ObjectInput stream used to read the compressed stream.

Throws

IOException - is thrown when there is an exception reading the compressed stream.

ClassNotFoundException - is thrown when the class is not found

removeAttribute(String)

Description

Removes an attribute by name. If the removed attribute has a default value it is immediately replaced.

Syntax

public void removeAttribute(java.lang.String name)

Parameters

name - The name of the attribute to remove.

Throws

DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

removeAttributeNode(Attr)

Description

Removes the specified attribute.

Syntax

public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)

Parameters

oldAttr - The Attr node to remove from the attribute list. If the removed Attr has a default value it is immediately replaced.

Returns

The Attr node that was removed.

Throws

DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. NOT_FOUND_ERR: Raised if oldAttr is not an attribute of the element.

removeAttributeNS(String, String)

Description

Removes an attribute by local name and namespace URI.

Syntax

public void removeAttributeNS(java.lang.String namespaceURI, java.lang.String 
localName)

Parameters

namespaceURI - namespace of the attribute to be removed

localName - local name of the attribute to be removed

Throws

DOMEXception - NO_MODIFICATIONS_ALLOWED_ERR : if this element is readonly

Since

DOM 2

reportSAXEvents(ContentHandler)

Description

Report SAX Events from a DOM Tree

Syntax

public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)

Parameters

ContentHandler - cntHandler

Throws

SAXException - thrown by SAX Callback functions

resolveNamespacePrefix(String)

Description

Given a namespace prefix, find the namespace definition in scope in this element.

Syntax

public java.lang.String resolveNamespacePrefix(java.lang.String prefix)

Specified By

NSResolver.resolveNamespacePrefix(String) in interface NSResolver

Parameters

prefix - Namespace prefix to be resolved if the prefix == #default, return the default namespace

Returns

the resolved Namespace (null, if prefix could not be resolved)

setAttribute(String, String)

Description

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.

Syntax

public void setAttribute(java.lang.String name, java.lang.String value)

Comments

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

Parameters

name - The name of the attribute to create or alter.

value - Value to set in string form.

Throws

DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

setAttributeNode(Attr)

Description

Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one.

Syntax

public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)

Parameters

newAttr - The Attr node to add to the attribute list.

Returns

If the newAttr attribute replaces an existing attribute with the same name, the previously existing Attr node is returned, otherwise null is returned.

Throws

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.

setAttributeNodeNS(Attr)

Description

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.

Syntax

public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)

Parameters

Attribute - node to be added

Returns

the Attribute Node added

Throws

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

Since

DOM 2

setAttributeNS(String, String, String)

Description

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.

Syntax

public void setAttributeNS(java.lang.String namespaceURI, java.lang.String 
qualifiedName, java.lang.String value)

Parameters

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

Throws

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

Since

DOM 2

validateContent(DTD)

Description

Validates the content of a element node.

Syntax

public boolean validateContent(DTD dtd)

Parameters

dtd - The DTD object used to validate the element.

schema - The XMLSchema object used to validate the element.

Returns

True if valid, else false

validateContent(XMLSchema)

Description

Validates the content of the element against given XML Schema param schema - schema used to validate

Syntax

public boolean validateContent(oracle.xml.parser.schema.XMLSchema schema)

Returns

True if valid, else false

validateContent(XMLSchema, String)

Description

Validates the content of the element against given XML Schema in the given mode.

Syntax

public boolean validateContent(oracle.xml.parser.schema.XMLSchema schema, 
java.lang.String mode)

Parameters

schem - - schema used to validate the content

mode - - the validation mode

Returns

True if valid, else false

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binray compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Parameters

outArg: The ObjectOutput stream used to write the serialized/compressed stream.

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

cxmlContext - The context of the output compressed stream


XMLEntity

Description

This class implements the DOM Entity interface and represens an XML internal or external entity as defined in the XML Document Type Definition (DTD).

Syntax

public class XMLEntity implements java.io.Externalizable
 
oracle.xml.parser.v2.XMLEntity

Implemented Interfaces

java.io.Externalizable, java.io.Serializable

Constructors

XMLEntity()

Description

Default constructor.

Syntax

public  XMLEntity()

Comments

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.


Methods

cloneNode(boolean)

Description

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

Syntax

public org.w3c.dom.Node cloneNode(boolean deep)

Comments

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.

Parameters

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).

Returns

The duplicate node.

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getNodeValue()

Description

Gets the value of this node, depending on its type

Syntax

public java.lang.String getNodeValue()

Returns

Value of this node

Throws

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.

getNotationName()

Description

For unparsed entities, gets the name of the notation for the entity. For parsed entities, this is null.

Syntax

public java.lang.String getNotationName()

Returns

The notation name

getPublicId()

Description

Gets the public identifier associated with the entity, if specified. If the public identifier was not specified, this is null.

Syntax

public java.lang.String getPublicId()

Returns

The public identifier

getSystemId()

Description

Gets the system identifier associated with the entity, if specified. If the system identifier was not specified, this is null.

Syntax

public java.lang.String getSystemId()

Returns

The system identifier

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - the ObjectInput stream used for reading the compressed stream.

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found.

setNodeValue(String)

Description

Sets the value of entity.

Syntax

public void setNodeValue(java.lang.String arg)

Parameters

arg - The new value of the entity.

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

outArg - The ObjectOutput stream used to write the serialized/ compressed stream.

Throws

IOException - is thrown when there is an exception while writing the serialized/compressed stream.


XMLEntityReference

Description

This class implements DOM EntityReference interface.

Syntax

public class XMLEntityReference implements java.lang.Cloneable, 
java.io.Externalizable
 
oracle.xml.parser.v2.XMLEntityReference

Implemented Interfaces

java.lang.Cloneable, java.io.Externalizable, java.io.Serializable

Constructors

XMLEntityReference()

Description

Default constructor.

Syntax

public  XMLEntityReference()

Comments

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.


Methods

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - The ObjectInput stream used for reading the compressed stream

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

outArg - is the ObjectOutput stream used to write the compressed stream.

Throws

IOException - is thrown when there is an exception while writing the compressed stream.


XMLError

Description

This class hold error message and the line number where it occured

Syntax

public class XMLError extends oracle.xml.util.XMLError
 
oracle.xml.util.XMLError
  |
  +--oracle.xml.parser.v2.XMLError


Constructors

XMLError()

Description

Default constructor

Syntax

public  XMLError()

Methods

error(int, int, String, String, String, int, int, boolean)

Description

Adds a new error to the vector

Syntax

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)

Parameters

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

throws - ParseException in case of a fatal error

flushErrorListener(DOMLocator)

Description

Flush all the error to the error listener

Syntax

public void flushErrorListener(oracle.xml.parser.v2.DOMLocator locator)

Parameters

locator - the DOM Locator object

flushErrorListenerStream(DOMLocator)

Description

Flush all the error to the error listener

Syntax

public void flushErrorListenerStream(oracle.xml.parser.v2.DOMLocator locator)

Parameters

locator - the DOM Locator object

flushErrors()

Description

Flush all the error to the ouput stream output stream defaults or to error handler

Syntax

public void flushErrors()

Throws

throws - ParseException in case of a fatal error

getErrorHandler()

Description

Return register error handler

Syntax

public org.xml.sax.ErrorHandler getErrorHandler()

Returns

ErrorHandler

getErrorListener()

Description

Return register error listener

Syntax

public javax.xml.transform.ErrorListener getErrorListener()

Returns

ErrorListener

setErrorHandler(ErrorHandler)

Description

Register error handler

Syntax

public void setErrorHandler(org.xml.sax.ErrorHandler err)

Parameters

err - - ErrorHandler

setErrorListener(ErrorListener)

Description

Register error listener

Syntax

public void setErrorListener(javax.xml.transform.ErrorListener el)

Parameters

err - - ErrorListener


XMLNode

Description

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.

Syntax

public abstract class XMLNode implements java.lang.Cloneable, 
java.io.Externalizable
 
oracle.xml.parser.v2.XMLNode

Direct Known Subclasses

XMLNSNode

Implemented Interfaces

java.lang.Cloneable, java.io.Externalizable, java.io.Serializable

Comments

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.

Fields of XMLNode

Table 11-17 Fields of XMLNode
Field Syntax Description

ATTRDECL

public static final short ATTRDECL

A attribute declaration node

Auto_Events

public static final java.lang.String Auto_Events

Flag to set Auto EVENTS

capturing

public static final java.lang.String capturing

DOMAttrModified

public static final java.lang.String DOMAttrModified

DOMCharacterDataModified

public static final java.lang.String DOMCharacterDataModified

DOMNodeInserted

public static final java.lang.String DOMNodeInserted

DOMNodeInsertedIntoDocument

public static final java.lang.String DOMNodeInsertedIntoDocument

DOMNodeRemoved

public static final java.lang.String DOMNodeRemoved

DOMNodeRemovedFromDocument

public static final java.lang.String DOMNodeRemovedFromDocument

DOMSubtreeModified

public static final java.lang.String DOMSubtreeModified

ELEMENTDECL

public static final short ELEMENTDECL

An element declaration node

noncapturing

public static final java.lang.String noncapturing

RANGE_DELETE_EVENT

public static final java.lang.String RANGE_DELETE_EVENT

Flag to delete range event

RANGE_DELETETEXT_EVENT

public static final java.lang.String RANGE_DELETETEXT_EVENT

Flag to set range delete text event

RANGE_INSERT_EVENT

public static final java.lang.String RANGE_INSERT_EVENT

Flag to set range event

RANGE_INSERTTEXT_EVENT

public static final java.lang.String RANGE_INSERTTEXT_EVENT

Flag to set range insert text event

RANGE_REPLACE_EVENT

public static final java.lang.String RANGE_REPLACE_EVENT

Flag to replace range event

RANGE_SETTEXT_EVENT

public static final java.lang.String RANGE_SETTEXT_EVENT

Flag to set range text event

TRAVERSAL_DELETE_EVENT

public static final java.lang.String TRAVERSAL_DELETE_EVENT

Flag to set traversal delete event

TRAVERSAL_REPLACE_EVENT

public static final java.lang.String TRAVERSAL_REPLACE_EVENT

Flag to set traversal replace event

XMLDECL_NODE

public static final short XMLDECL_NODE

A attribute declaration node


Methods

XMLNode()

Description

Constructs a new XMLNode having the given name and type

Syntax

protected  XMLNode()

Parameters

tag - Name of the node

addEventListener(String, EventListener, boolean)

Description

This method allows the registration of event listeners on the event target (node).

Syntax

public void addEventListener(java.lang.String type, 
org.w3c.dom.events.EventListener listener, boolean useCapture)

DOMEvents

Parameters

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

appendChild(Node)

Description

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.

Syntax

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)

Parameters

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

Returns

The node added.

Throws

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.

cloneNode(boolean)

Description

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

Syntax

public org.w3c.dom.Node cloneNode(boolean deep)

Comments

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.

Parameters

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).

Returns

The duplicate node

dispatchEvent(Event)

Description

This method allows the dispatch of events into the implementations event model

Syntax

public boolean dispatchEvent(org.w3c.dom.events.Event evt)

Returns

boolean value that indicates whether preventDefault or stopPropogation was called

Throws

UNSPECIFIED_EVENT_TYPE: - Raised if the Event's type was not specified by initializing the event before dispatchEvent was called.

getAttributes()

Description

Gets a NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.

Syntax

public org.w3c.dom.NamedNodeMap getAttributes()

Returns

the attributes of this node

getChildNodes()

Description

Gets a NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.

Syntax

public org.w3c.dom.NodeList getChildNodes()

Comments

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.

Returns

The children of this node

getColumnNumber()

Description

Get column number debug information

Syntax

public int getColumnNumber()

Returns

column the column number

getDebugMode()

Description

Get debug information mode

Syntax

public boolean getDebugMode()

Returns

flag debugging mode

getFirstChild()

Description

Gets the first child of this node. If there is no such node, this returns null.

Syntax

public org.w3c.dom.Node getFirstChild()

Returns

The first child of this node

getLastChild()

Description

Gets the last child of this node. If there is no such node, this returns null.

Syntax

public org.w3c.dom.Node getLastChild()

Returns

The last child of this node

getLineNumber()

Description

Get line number debug information

Syntax

public int getLineNumber()

Returns

line the line number

getLocalName()

Description

Gets the Local Name of this node overrided by node types for which namespace is meaningful.

Syntax

public java.lang.String getLocalName()

Since

DOM 2

getNamespaceURI()

Description

Gets the namespace URI of this node. overrided by node types for which namespace is meaningful.

Syntax

public java.lang.String getNamespaceURI()

Returns

the namespace

Since

DOM 2

getNextSibling()

Description

Gets The node immediately following this node. If there is no such node, this returns null.

Syntax

public org.w3c.dom.Node getNextSibling()

Returns

The next node

getNodeName()

Description

Gets the name of the node

Syntax

public java.lang.String getNodeName()

Returns

name of the node

getNodeType()

Description

Gets the type of the node

Syntax

public short getNodeType()

Returns

type of the node

getNodeValue()

Description

Gets the value of this node, depending on its type

Syntax

public java.lang.String getNodeValue()

Returns

Value of this node

Throws

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.

getOwnerDocument()

Description

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.

Syntax

public org.w3c.dom.Document getOwnerDocument()

Returns

The document associated with this node

getParentNode()

Description

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.

Syntax

public org.w3c.dom.Node getParentNode()

Returns

The parent of this node

getPrefix()

Description

Gets the prefix of this node overrided by node types for which namespace is meaningful.

Syntax

public java.lang.String getPrefix()

Returns

the prefix

Since

DOM 2

getPreviousSibling()

Description

Gets the node immediately preceding this node. If there is no such node, this returns null.

Syntax

public org.w3c.dom.Node getPreviousSibling()

Returns

the previous node

getProperty(String)

Description

Get a property of the node

Syntax

public java.lang.Object getProperty(java.lang.String propName)

Parameters

propName - - Name of the property

Returns

Object propValue - Value of the property

getSystemId()

Description

Get the system id of the entity contain this node

Syntax

public java.lang.String getSystemId()

Returns

sysid the system id

getText()

Description

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.

Syntax

public java.lang.String getText()

Comments

For example, if the XML document contains the following: William Shakespeare

XMLDocument.getText returns "William Shakespeare".

Returns

Non-marked-up text contained by the element

hasAttributes()

Description

Returns whether this node (if it is an element) has any attributes.

Syntax

public boolean hasAttributes()

Returns

true if this node has any attributes, false otherwise.

Since

DOM Level 2

hasChildNodes()

Description

This is a convenience method to allow easy determination of whether a node has any children.

Syntax

public boolean hasChildNodes()

Returns

true if the node has any children, false if the node has no children.

insertBefore(Node, Node)

Description

Inserts the node newChild before the existing child node refChild.

Syntax

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node 
refChild)

Comments

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.

Parameters

newChild - The node to insert.

refChild - The reference node, i.e., the node before which the new node must be inserted.

Returns

The node being inserted.

Throws

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.

isNodeFlag(int)

Description

Returns the node flag information

Syntax

public boolean isNodeFlag(int flag)

Returns

true if the flag is set

isSupported(String, String)

Description

Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.

Syntax

public boolean isSupported(java.lang.String feature, java.lang.String version)

Parameters

String - feature ,String version

Returns

true,if the feature is supported else false

print(OutputStream)

Description

Writes the contents of this node to the given output stream.

Syntax

public void print(java.io.OutputStream out)

Parameters

out - OutputStream to write to

Throws

IOException - if an error occurs

print(OutputStream, String)

Description

Writes the contents of this node to the given output stream.

Syntax

public void print(java.io.OutputStream out, java.lang.String enc)

Parameters

out - OutputStream to write to

enc - Encoding to use for the output

Throws

IOException - if an invalid encoding was specified or if any other error occurs

print(PrintWriter)

Description

Writes the contents of this node using the given print writer.

Syntax

public void print(java.io.PrintWriter out)

Parameters

out - PrintWriter to use

Throws

IOException - if an error occurs

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

inArg - the ObjectInput stream used for reading the compressed stream

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

removeChild(Node)

Description

Removes the child node indicated by oldChild from the list of children, and returns it.

Syntax

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)

Parameters

oldChild - The node being removed.

Returns

The node removed.

Throws

DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

removeEventListener(String, EventListener, boolean)

Description

This method allows the removal of event listeners from the event target (node).

Syntax

public void removeEventListener(java.lang.String type, 
org.w3c.dom.events.EventListener listener, boolean useCapture)

Parameters

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

replaceChild(Node, Node)

Description

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.

Syntax

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node 
oldChild)

Parameters

newChild - The new node to put in the child list.

oldChild - The node being replaced in the list.

Returns

The node replaced.

Throws

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.

reportSAXEvents(ContentHandler)

Description

Report SAX Events from a DOM Tree

Syntax

public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)

Parameters

ContentHandler - cntHandler

Throws

SAXException - thrown by SAX Callback functions

resetNodeFlag(int)

Description

Resets the node flag information

Syntax

public void resetNodeFlag(int flag)

Parameters

flag - the node flag

selectNodes(String)

Description

Selects nodes from the tree which match the given pattern. This method assumes that the pattern does not contain namespace prefixes.

Syntax

public org.w3c.dom.NodeList selectNodes(java.lang.String pattern)

Parameters

pattern - XSL pattern to match

Returns

a list of matching nodes

Throws

XSLException - Raised if there is an error while doing the match

selectNodes(String, NSResolver)

Description

Selects nodes from the tree which match the given pattern

Syntax

public org.w3c.dom.NodeList selectNodes(java.lang.String pattern, NSResolver 
nsr)

Parameters

pattern - XSL pattern to match

nsr - NSResolver to resolve any namespace prefixes that occur in the given pattern

Returns

a list of matching nodes

Throws

XSLException - Raised if there is an error while doing the match

selectSingleNode(String)

Description

Selects the first node from the tree that matches the given pattern

Syntax

public org.w3c.dom.Node selectSingleNode(java.lang.String pattern)

Parameters

pattern - XSL pattern to match

Returns

matching node

Throws

XSLException - Raised if there is an error while doing the match

selectSingleNode(String, NSResolver)

Description

Selects the first node from the tree that matches the given pattern

Syntax

public org.w3c.dom.Node selectSingleNode(java.lang.String pattern, NSResolver 
nsr)

Parameters

pattern - XSL pattern to match

nsr - NSResolver to resolve any prefixes that occur in given pattern

Returns

matching node

Throws

XSLException - Raised if there is an error while doing the match

setDebugInfo(int, int, String)

Description

Set debug information in the node

Syntax

public void setDebugInfo(int line, int col, java.lang.String sysid)

Parameters

line - the line number

col - the col number

sysid - the system id

setNodeFlag(int)

Description

Sets the node flag information

Syntax

public void setNodeFlag(int flag)

Parameters

flag - the node flag

setNodeValue(String)

Description

Sets the value of this node, depending on its type

Syntax

public void setNodeValue(java.lang.String nodeValue)

Throws

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.

setPrefix(String)

Description

Sets the prefix of this node overrided by node types for which namespace is meaningful.

Syntax

public void setPrefix(java.lang.String prefix)

Parameters

prefix - set the prefix

Throws

DOMException - if any DOM Exception occurs

Since

DOM 2

setProperty(String, Object)

Description

Set a property of the node

Syntax

public void setProperty(java.lang.String propName, java.lang.Object propValue)

Parameters

propName - - Name of the property

propValue - - Value of the property

supports(String, String)

Description

Syntax

public boolean supports(java.lang.String feature, java.lang.String version)

Comments

Deprecated; use isSupported instead

Parameters

String - feature ,String version

Returns

true,if the feature is supported else false

Since

DOM 2 Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.

transformNode(XSLStylesheet)

Description

Transforms a node in the tree using the given stylesheet

Syntax

public org.w3c.dom.DocumentFragment transformNode(XSLStylesheet xsl)

Parameters

xsl - XSLStylesheet to be used for transformation

Returns

a document fragment

Throws

XSLException - Raised if there is an error while doing the XSL transformation.

valueOf(String)

Description

Selects the value of the first node from tree that matches the pattern

Syntax

public java.lang.String valueOf(java.lang.String pattern)

Parameters

pattern - XSL pattern to match

Returns

value of the matching node

Throws

XSLException - Raised if there is an error while doing the match

valueOf(String, NSResolver)

Description

Selects the value of the first node from tree that matches the pattern

Syntax

public java.lang.String valueOf(java.lang.String pattern, NSResolver nsr)

Parameters

pattern - XSL pattern to match

nsr - NSResolver to resolve any prefixes that occur in given pattern

Returns

value of the matching node

Throws

XSLException - Raised if there is an error while doing the match

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput out)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

out - The ObjectOutput stream used to write the serialized/ compressed stream.

Throws

IOException - is thrown when there is an exception while writing the serialized/compressed stream.


XMLNotation

Description

This class implements the DOM Notation interface and represents a notation declared in the Document Type Definition.

Syntax

public class XMLNotation implements java.io.Externalizable
 
oracle.xml.parser.v2.XMLNotation

Implemented Interfaces

java.io.Externalizable, java.io.Serializable

Constructors

XMLNotation()

Description

Default constructor

Syntax

public  XMLNotation()

Comments

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)


Methods

cloneNode(boolean)

Description

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

Syntax

public org.w3c.dom.Node cloneNode(boolean deep)

Comments

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.

Parameters

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).

Returns

The duplicate node.

getNodeName()

Description

Gets the name of the Notation

Syntax

public java.lang.String getNodeName()

Returns

name of the node

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getPublicId()

Description

Gets the Public identifer; if not specified, then null

Syntax

public java.lang.String getPublicId()

Returns

The public identifier

getSystemId()

Description

Gets the System identifer; if not specified, then null

Syntax

public java.lang.String getSystemId()

Returns

The System identifier

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

in - the ObjectInput stream used for reading the compressed stream.

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found.

setPublicId(String)

Description

Sets the Public Identifier

Syntax

public void setPublicId(java.lang.String pubid)

Parameters

pubid - Public Identifier to set

setSystemId(String)

Description

Sets the System Identifier

Syntax

public void setSystemId(java.lang.String url)

Parameters

url - System Identifier to set

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binray compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

out - The ObjectOutput stream used to write the serialized/ compressed stream.

Throws

IOException - is thrown when there is an exception while writing the serialized/compressed stream.


XMLNSNode

Syntax

public class XMLNSNode extends oracle.xml.parser.v2.XMLNode
 
oracle.xml.parser.v2.XMLNode
  |
  +--oracle.xml.parser.v2.XMLNSNode

Implemented Interfaces

java.lang.Cloneable, java.io.Externalizable, java.io.Serializable

Description

Extends XMLNode to add support for Namespace names and children


Constructors

XMLNSNode(String)

Description

Constructs a new XMLNSNode having the given name and type

Syntax

protected  XMLNSNode(java.lang.String tag)

Parameters

tag - Name of the node


Methods

addText(char[], int, int)

Description

Adds text to this node, or appends str to the last child if the last child is a text node.

Syntax

public void addText(char[] ch, int start, int length)

Parameters

ch - char array to add

start - start index in the char array

length - no of chars to be added

Throws

XMLDOMException - if text can't be added to this node

addText(String)

Description

Adds text to this node, or appends str to the last child if the last child is a text node.

Syntax

public XMLNode addText(java.lang.String str)

Parameters

str - text to add

Throws

XMLDOMException - if text can't be added to this node

appendChild(Node)

Description

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.

Syntax

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChildArg)

Overrides

XMLNode.appendChild(Node) in class XMLNode

Parameters

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

Returns

The node added.

Throws

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.

getChildNodes()

Description

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.

Syntax

public org.w3c.dom.NodeList getChildNodes()

Overrides

XMLNode.getChildNodes() in class XMLNode

Returns

The children of this node

getFirstChild()

Description

Gets the first child of this node. If there is no such node, this returns null.

Syntax

public org.w3c.dom.Node getFirstChild()

Overrides

XMLNode.getFirstChild() in class XMLNode

Returns

The first child of this node

getLastChild()

Description

Gets the last child of this node. If there is no such node, this returns null.

Syntax

public org.w3c.dom.Node getLastChild()

Overrides

XMLNode.getLastChild() in class XMLNode

Returns

The last child of this node

getLocalName()

Description

Gets the Local Name of this node overrided by node types for which namespace is meaningful.

Syntax

public java.lang.String getLocalName()

Overrides

XMLNode.getLocalName() in class XMLNode

Returns

localname of the node

Since

DOM 2

getNamespaceURI()

Description

Gets the namespace URI of this node. overrided by node types for which namespace is meaningful.

Syntax

public java.lang.String getNamespaceURI()

Overrides

XMLNode.getNamespaceURI() in class XMLNode

Returns

namespace of the node

Since

DOM 2

getNodeName()

Description

Gets the name of this node, depending on its type

Syntax

public java.lang.String getNodeName()

Overrides

XMLNode.getNodeName() in class XMLNode

Returns

Name of this node

getPrefix()

Description

Gets the prefix of this node overrided by node types for which namespace is meaningful.

Syntax

public java.lang.String getPrefix()

Overrides

XMLNode.getPrefix() in class XMLNode

Returns

prefix of the node

Since

DOM 2

getText()Description

Description

Returns the non-marked-up text contained by this element.

Syntax

public java.lang.String getText()

Comments

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".

Overrides

XMLNode.getText() in class XMLNode

Returns

non-marked-up text contained bu this element

hasChildNodes()

Description

This is a convenience method to allow easy determination of whether a node has any children.

Syntax

public boolean hasChildNodes()

Overrides

XMLNode.hasChildNodes() in class XMLNode

Returns

true if the node has any children, false if the node has no children.

insertBefore(Node, Node)

Description

Inserts the node newChild before the existing child node refChild.

Syntax

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChildArg, 
org.w3c.dom.Node refChildArg)

Comments

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.

Overrides

XMLNode.insertBefore(Node, Node) in class XMLNode

Parameters

newChild - The node to insert.

refChild - The reference node, i.e., the node before which the new node must be inserted.

Returns

The node being inserted.

Throws

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.

normalize()

Description

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.

Syntax

public void normalize()

Comments

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.

Overrides

XMLNode.normalize() in class XMLNode

Since

DOM 2

removeChild(Node)

Description

Removes the child node indicated by oldChild from the list of children, and returns it.

Syntax

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChildArg)

Overrides

XMLNode.removeChild(Node) in class XMLNode

Parameters

oldChild - The node being removed.

Returns

The node removed.

Throws

DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

replaceChild(Node, Node)

Description

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.

Syntax

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChildArg, 
org.w3c.dom.Node oldChildArg)

Overrides

XMLNode.replaceChild(Node, Node) in class XMLNode

Parameters

newChild - The new node to put in the child list.

oldChild - The node being replaced in the list.

Returns

The node replaced.

Throws

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.

setPrefix(String)

Description

Sets the prefix of this node overrided by node types for which namespace is meaningful.

Syntax

public void setPrefix(java.lang.String prefix)

Overrides

XMLNode.setPrefix(String) in class XMLNode

Parameters

prefix - Sets the prefix of the node

Since

DOM 2


XMLOutputStream

Description

XMLOutputSteam -- writes output stream, can handle XML encoding

Syntax

public class XMLOutputStream extends java.lang.Object
 
java.lang.Object
  |
  +--oracle.xml.parser.v2.XMLOutputStream

Fields of XMLOutputStream

Table 11-18 Fields of XMLOutputStream
Field Syntax Description

COMPACT

public static int COMPACT

DEFAULT

public static int DEFAULT

PRETTY

public static int PRETTY

Constructors

XMLOutputStream(OutputStream)

Description

Builds the ASCII output stream

Syntex

public  XMLOutputStream(java.io.OutputStream out)

Parameters

out - the output stream

XMLOutputStream(PrintWriter)

Description

Builds the output stream from PrintWriter

Syntax

public  XMLOutputStream(java.io.PrintWriter out)

Parameters

out - the PrintWriter stream


Methods

addIndent(int)

Description

Set indenting level for output

Syntax

public void addIndent(int offset)

Parameters

offset - the indenting level

close()

Description

Closes the output stream

Syntax

public void close()

Throws

IOException - if there is any error in closing the output stream

flush()

Description

Flushes the output stream

Syntax

public void flush()

Throws

IOException - if there is any error in flushing the output stream

getOutputStyle()

Description

Gets the Current output style

Syntax

public int getOutputStyle()

setEncoding(String, boolean, boolean)

Description

Sets the output character encoding

Syntax

public void setEncoding(java.lang.String encoding, boolean lendian, boolean 
byteOrderMark)

Parameters

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

Throws

IOException - if error is thrown in setting the encoding type

setOutputStyle(int)

Description

Sets the Output the style

Syntax

public void setOutputStyle(int style)

Parameters

style - the output style

write(int)

Description

Outputs character according to type of the output stream

Syntax

public void write(int c)

Parameters

c - the character that needs to be written

Throws

IOException - if there is any error in writing the character

writeChars(String)

Description

Write string to the output

Syntax

public void writeChars(java.lang.String str)

Parameters

str - the string that is written to the output stream

Throws

IOException - error thrown if there is any error in writing the string

writeIndent()

Description

Output the indentation

Syntax

public void writeIndent()

Throws

IOException - error thrown if there is any error in writing the string

writeNewLine()

Description

Newline writer

Syntax

public void writeNewLine()

Throws

IOException - error thrown if there is any error in writing the string

writeQuotedString(String)

Description

Write string with surrounding quotes

Syntax

public void writeQuotedString(java.lang.String str)

Parameters

str - the string that is written to the output stream

Throws

IOException - error thrown if there is any error in writing the string


XMLParseException

Description

Indicates that a parsing exception occurred while processing an XML document

Syntax

public class XMLParseException
 
oracle.xml.parser.v2.XMLParseException

Fields of XMLParseException

Table 11-19 Fields of XMLParseException
Field Syntax Description

ERROR

public static final int ERROR

Code for non-fatal error

FATAL_ERROR

public static final int FATAL_ERROR

Code for fatal error

WARNING

public static final int WARNING

Code for warning


Constructors

XMLParseException(String, String, String, int, int, int)

Description

Syntax

public  XMLParseException(java.lang.String mesg, java.lang.String pubId, 
java.lang.String sysId, int line, int col, int type)

Methods

formatErrorMessage(int)

Description

Get the error message at specified index

Syntax

public java.lang.String formatErrorMessage(int i)

Returns

The error message

getColumnNumber(int)

Description

Get the column number of error at specified index

Syntax

public int getColumnNumber(int i)

Returns

The column number

getException(int)

Description

Get the exception (if exists) that occured in error at specified index

Syntax

public java.lang.Exception getException(int i)

Returns

The exception

getLineNumber(int)

Description

Get the line number of error at specified index

Syntax

public int getLineNumber(int i)

Returns

The line number

getMessage(int)

Description

Get the error message at specified index

Syntax

public java.lang.String getMessage(int i)

Returns

The error message

getMessageType(int)

Description

Get the type of the error message at specified index

Syntax

public int getMessageType(int i)

Returns

The error message type

getNumMessages()

Description

Return the total number of errors/warnings found during parsing

Syntax

public int getNumMessages()

Returns

The number of errors/warnings

getPublicId(int)

Description

Get the public ID of input when error at specified index occured

Syntax

public java.lang.String getPublicId(int i)

Returns

The public ID

getSystemId(int)

Description

Get the system ID of input when error at specified index occured

Syntax

public java.lang.String getSystemId(int i)

Returns

The system ID


XMLParser

Description

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).

Syntax

public abstract class XMLParser
 
oracle.xml.parser.v2.XMLParser

Fields of XMLParser

Table 11-20 Fields of XMLParser
Field Syntax Description

BASE_URL

public static final java.lang.String BASE_URL

Base URL used in parsing entities. Replaces setBaseURL(); Should be URL object

DTD_OBJECT

public static final java.lang.String DTD_OBJECT

DTD Object to be used for validation. Replaces XMLParser.setDoctype()

SCHEMA_OBJECT

public static final java.lang.String SCHEMA_OBJECT

Schema Object to be used for validation. Replaces XMLParser.setXMLSchema()

STANDALONE

public static final java.lang.String STANDALONE

Sets the standalone property of the input files. If true the DTDs are not retrieved.

USE_DTD_ONLY_FOR_VALIDATION

public static final java.lang.String USE_DTD_ONLY_FOR_VALIDATION

If true, DTD Object is used only for validation and is not added to the parser document (Boolean.TRUE or Boolean.FALSE) This property/attribute is only if setDoctype is called to use a fixed DTD.


Methods

getAttribute(String)

Description

Allows the user to retrieve specific attributes on the underlying implementation.

Syntax

public java.lang.Object getAttribute(java.lang.String name)

Parameters

name - The name of the attribute.

Returns

value The value of the attribute.

Throws

IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

getBaseURL()

Description

Gets the base URL

Syntax

public java.net.URL getBaseURL()

Returns

the base URL

getEntityResolver()

Description

Return the current entity resolver.

Syntax

public org.xml.sax.EntityResolver getEntityResolver()

Returns

The current entity resolver, or null if none has been registered.

Since

SAX 2.0

See Also

setEntityResolver(EntityResolver)

getErrorHandler()

Description

Return the current error handler.

Syntax

public org.xml.sax.ErrorHandler getErrorHandler()

Returns

The current error handler, or null if none has been registered.

Since

SAX 2.0

See Also

setErrorHandler(ErrorHandler)

getReleaseVersion()Description

Description

Returns the release version of the Oracle XML Parser

Syntax

public static java.lang.String getReleaseVersion()

Returns

the release version string

getValidationModeValue()

Description

Returns the validation mode

Syntax

public int getValidationModeValue()

Returns

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

getXMLProperty(String)

Description

Get a property. The property is returned if present and supported, else null is returned

Syntax

public java.lang.Object getXMLProperty(java.lang.String name)

Parameters

name - - name of the property

Returns

Object - value of the property

isXMLPropertyReadOnly(String)

Description

Check is the property is read-only Returns true if the property is not supported

Syntax

public boolean isXMLPropertyReadOnly(java.lang.String name)

Parameters

name - - name of the property

Returns

boolean - TRUE is read-only

isXMLPropertySupported(String)

Description

Check is the property is supported

Syntax

public boolean isXMLPropertySupported(java.lang.String name)

Parameters

name - - name of the property

Returns

boolean - TRUE is supported

parse(InputSource)

Description

Parses the XML from given input source

Syntax

public void parse(org.xml.sax.InputSource in)

Parameters

in - the org.xml.sax.InputSouce to parse

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

parse(InputStream)

Description

Parses the XML from given input stream. The base URL should be set for resolving external entities and DTD.

Syntax

public final void parse(java.io.InputStream in)

Parameters

in - the InputStream containing XML data to parse.

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

See Also

setBaseURL(URL)

parse(Reader)

Description

Parses the XML from given input stream. The base URL should be set for resolving external entities and DTD.

Syntax

public final void parse(java.io.Reader r)

Parameters

r - the Reader containing XML data to parse.

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

See Also

setBaseURL(URL)

parse(String)

Description

Parses the XML from the URL indicated

Syntax

public void parse(java.lang.String in)

Parameters

in - the String containing the URL to parse from

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

parse(URL)

Description

Parses the XML document pointed to by the given URL and creates the corresponding XML document hierarchy.

Syntax

public final void parse(java.net.URL url)

Parameters

url - the url points to the XML document to parse.

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

reset()

Description

Resets the parser state

Syntax

public void reset()

setAttribute(String, Object)

Description

Allows the user to set specific attributes on the underlying implementation.

Syntax

public void setAttribute(java.lang.String name, java.lang.Object value)

Parameters

name - The name of the attribute.

value - The value of the attribute.

Throws

IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

setBaseURL(URL)

Description

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

Syntax

public void setBaseURL(java.net.URL url)

Parameters

url - The base URL

setDoctype(DTD)

Description

Set the DTD

Syntax

public void setDoctype(DTD dtd)

Parameters

dtd - DTD to set and used while parsing

setEntityResolver(EntityResolver)

Description

Allow an application to register an entity resolver.

Syntax

public void setEntityResolver(org.xml.sax.EntityResolver resolver)

Comments

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.

Parameters

resolver - The entity resolver.

Throws

java.lang.NullPointerException - If the resolver argument is null.

See Also

getEntityResolver()

setErrorHandler(ErrorHandler)

Description

Allow an application to register an error event handler.

Syntax

public void setErrorHandler(org.xml.sax.ErrorHandler handler)

Comments

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.

Parameters

handler - The error handler.

Throws

java.lang.NullPointerException - If the handler argument is null.

See Also

getErrorHandler()

setLocale(Locale)

Description

Applications can use this to set the locale for error reporting.

Syntax

public void setLocale(java.util.Locale locale)

Parameters

locale - Locale to set

Throws

SAXException - A SAXException could be thrown.

See Also

org.xml.sax.Parser

setPreserveWhitespace(boolean)

Description

Set the white space preserving mode

Syntax

public void setPreserveWhitespace(boolean flag)

Parameters

flag - preserving mode

setValidationMode(int)

Description

Set the validation mode

Syntax

public void setValidationMode(int valMode)

Comments

This method sets the validation mode of the parser to one of the 4 types: NONVALIDATING, PARTIAL_VALIDATION, DTD_VALIDATION and SCHEMA_VALIDATION.

Parameters

valMode - determines the type of the validation mode which the parser is set to

setXMLProperty(String, Object)

Description

Set a property

Syntax

public java.lang.Object setXMLProperty(java.lang.String name, java.lang.Object 
value)

Comments

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.

Parameters

name - - name of the property

value - - value of the property

Returns

Object - the set property

setXMLSchema(Object)

Description

Set an XMLSchema for validating the instance document

Syntax

public void setXMLSchema(java.lang.Object schema)

Parameters

schema - The XMLSchema object


XMLPI

Description

This class implements the DOM Processing Instruction interface.

Syntax

public class XMLPI implements java.io.Externalizable
 
oracle.xml.parser.v2.XMLPI

Direct Known Subclasses

XMLDeclPI

All Implemented Interfaces

java.io.Externalizable, java.io.Serializable

See Also

ProcessingInstruction, NodeFactory, DOMParser.setNodeFactory(NodeFactory)


Constructors

XMLPI()

Description

Default constructor.

Syntax

public  XMLPI()

Comments

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.


Methods

addText(String)

Description

Adds text string to the node

Syntax

public XMLNode addText(java.lang.String str)

Parameters

str - the text string to be added

Returns

the node

getNodeName()

Description

Gets the name of the PI

Syntax

public java.lang.String getNodeName()

Returns

name of the node

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getTarget()

Description

Returns the target of this PI. XML defines this as the first token following markup that begins the processing instruction.

Syntax

public java.lang.String getTarget()

Returns

The target of the PI.

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

in - The ObjectInput stream used for reading the compressed stream

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

reportSAXEvents(ContentHandler)

Description

Report SAX Events from a DOM Tree

Syntax

public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)

Parameters

ContentHandler - cntHandler

Throws

SAXException - thrown by SAX Callback functions

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

out - is the ObjectOutput stream used to write the compressed stream.

Throws

IOException - is thrown when there is an exception while writing the compressed stream.


XMLPrintDriver

Description

The XMLPrintDriver implements PrintDriver interface.

Syntax

public class XMLPrintDriver extends java.lang.Object implements 
oracle.xml.parser.v2.PrintDriver
 
java.lang.Object
  |
  +--oracle.xml.parser.v2.XMLPrintDriver

Implemented Interfaces

PrintDriver

Fields of XMLPrintDriver

Table 11-21 Fields of XMLPrintDriver
Field Syntax Description

out

protected XMLOutputStream out


Constructors

XMLPrintDriver(OutputStream)

Description

Syntax

public  XMLPrintDriver(java.io.OutputStream os)

XMLPrintDriver(PrintWriter)

Description

Syntax

public  XMLPrintDriver(java.io.PrintWriter pw)

Methods

close()

Description

Closes the output stream or print writer

Syntax

public void close()

Specified By

PrintDriver.close() in interface PrintDriver

flush()

Description

Flushes the output stream or print writer

Syntax

public void flush()

Specified By

PrintDriver.flush() in interface PrintDriver

printAttribute(XMLAttr)

Description

Prints a XMLAttr node

Syntax

public void printAttribute(XMLAttr attr)

Specified By

PrintDriver.printAttribute(XMLAttr) in interface PrintDriver

Parameters

attr - The XMLAttr node.

printAttributeNodes(XMLElement)

Description

Calls print method for each attribute of the XMLElement

Syntax

public final void printAttributeNodes(XMLElement elem)

Specified By

PrintDriver.printAttributeNodes(XMLElement) in interface PrintDriver

Parameters

elem - The elem whose attributes are to be printed.

printCDATASection(XMLCDATA)

Description

Prints a XMLCDATA node

Syntax

public void printCDATASection(XMLCDATA cdata)

Specified By

PrintDriver.printCDATASection(XMLCDATA) in interface PrintDriver

Parameters

cdata - The XMLCDATA node.

printChildNodes(XMLNode)

Description

Calls print method for each child of the XMLNode

Syntax

public final void printChildNodes(XMLNode node)

Specified By

PrintDriver.printChildNodes(XMLNode) in interface PrintDriver

Parameters

node - The node whose children are to be printed.

printComment(XMLComment)

Description

Prints a XMLComment node

Syntax

public void printComment(XMLComment comment)

Specified By

PrintDriver.printComment(XMLComment) in interface PrintDriver

Parameters

comment - The comment node.

printDoctype(DTD)

Description

Prints an DTD.

Syntax

public void printDoctype(DTD dtd)

Specified By

PrintDriver.printDoctype(DTD) in interface PrintDriver

Parameters

dtd - The dtd to be printed.

printDocument(XMLDocument)

Description

Prints an XMLDocument.

Syntax

public void printDocument(XMLDocument doc)

Specified By

PrintDriver.printDocument(XMLDocument) in interface PrintDriver

Parameters

elem - The document to be printed.

printDocumentFragment(XMLDocumentFragment)

Description

Prints an empty XMLDocumentFragment object.

Syntax

public void printDocumentFragment(XMLDocumentFragment dfrag)

Specified By

PrintDriver.printDocumentFragment(XMLDocumentFragment) in interface PrintDriver

Parameters

dfrag - The document fragment to be printed.

printElement(XMLElement)

Description

Prints an XMLElement.

Syntax

public void printElement(XMLElement elem)

Specified By

PrintDriver.printElement(XMLElement) in interface PrintDriver

Parameters

elem - The element to be printed.

printEntityReference(XMLEntityReference)

Description

Prints a XMLEntityReference node

Syntax

public void printEntityReference(XMLEntityReference en)

Specified By

PrintDriver.printEntityReference(XMLEntityReference) in interface PrintDriver

Parameters

en - The XMLEntityReference node.

printProcessingInstruction(XMLPI)

Description

Prints a XMLPI node

Syntax

public void printProcessingInstruction(XMLPI pi)

Specified By

PrintDriver.printProcessingInstruction(XMLPI) in interface PrintDriver

Parameters

pi - The XMLPI node.

printTextNode(XMLText)

Description

Prints a XMLText node

Syntax

public void printTextNode(XMLText text)

Specified By

PrintDriver.printTextNode(XMLText) in interface PrintDriver

Parameters

text - The text node.

setEncoding(String)

Description

Sets the encoding of the print driver.

Syntax

public void setEncoding(java.lang.String enc)

Specified By

PrintDriver.setEncoding(String) in interface PrintDriver

Parameters

enc - The encoding of the document being printed.


XMLRangeException

Description

This class customizes the RangeException

Syntax

public class XMLRangeException
 
oracle.xml.parser.v2.XMLRangeException


Constructors

XMLRangeException(short)

Description

Syntax

public  XMLRangeException(short code)

XMLText

Description

This class implements the DOM Text interface.

Syntax

public class XMLText implements java.io.Serializable, java.io.Externalizable
 
oracle.xml.parser.v2.XMLText

Implemented Interfaces

java.io.Externalizable, java.io.Serializable

See Also

Text, NodeFactory, DOMParser.setNodeFactory(NodeFactory)


Constructors

XMLText()

Description

Default constructor.

Syntax

public  XMLText()

Comments

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.


Methods

addText(char[], int, int)

Description

Adds text to the data of the text node, similar to appendData

Syntax

public void addText(char[] ch, int start, int length)

Parameters

ch - char array to be appended

start - start index

length - length of the char array

getData()

Description

The character data of the node that implements this interface.

Syntax

public java.lang.String getData()

Comments

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.

Throws

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.

getNodeName()

Description

Gets the name of the XMLText

Syntax

public java.lang.String getNodeName()

Returns

name of the node

getNodeType()

Description

Gets a code representing the type of the underlying object

Syntax

public short getNodeType()

Returns

type of the node

getNodeValue()

Description

Gets a value of this text node

Syntax

public java.lang.String getNodeValue()

Returns

String value of the node

Throws

DOMException - in any error occurs when retrieving the value

isWhiteSpaceNode()

Description

Check is the text node is a whitespace node

Syntax

public boolean isWhiteSpaceNode()

Returns

boolean

readExternal(ObjectInput)

Description

This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.

Syntax

public void readExternal(java.io.ObjectInput inArg)

Comments

This method is called if XMLText object is deserialized (or read) as an independent node and not called from some other DOM node.

Specified By

java.io.Externalizable.readExternal(java.io.ObjectInput) in interface java.io.Externalizable

Parameters

in - The ObjectInput stream used for reading the compressed stream

Throws

IOException - is thrown when there is an error in reading the input stream.

ClassNotFoundException - is thrown when the class is not found

reportSAXEvents(ContentHandler)

Description

Report SAX Events from a DOM Tree

Syntax

public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler)

Parameters

ContentHandler - cntHandler

Throws

SAXException - thrown by SAX Callback functions

splitText(int)

Description

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.

Syntax

public org.w3c.dom.Text splitText(int offset)

Parameters

offset - Offset at which to split, starting from 0

Returns

New Text node

Throws

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.

writeExternal(ObjectOutput)

Description

This method saves the state of the object by creating a binary compressed stream with information about this object.

Syntax

public void writeExternal(java.io.ObjectOutput outArg)

Specified By

java.io.Externalizable.writeExternal(java.io.ObjectOutput) in interface java.io.Externalizable

Parameters

out - The ObjectOutput stream used to write the compressed stream.

Throws

IOException - is thrown when there is an exception while writing the compressed stream.


XMLToken Interface

Description

Basic interface for XMLToken

Syntax

public interface XMLToken

Comments

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.

Fields of XMLToken

Table 11-22 Fields of XMLToken
Field Syntax Description

AttListDecl

public static final int AttListDecl

AttListDecl ::= '<' '!' 'ATTLIST' S Name AttDef* S? '>'

AttName

public static final int AttName

AttName ::= Name

Attribute

public static final int Attribute

Attribute ::= AttName Eq AttValue

AttValue

public static final int AttValue

AttValue ::= '"' ([^<&"] | Reference)* '"'
| "'" ([^<&'] | Reference)* "'"

CDSect

public static final int CDSect

CDSect ::= CDStart CData CDEnd

CDStart ::= '<' '!' '[CDATA['

CData ::= (Char* - (Char* ']]>' Char*))

CDEnd ::= ']]>'

CharData

public static final int CharData

CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)

Comment

public static final int Comment

Comment ::= '<' '!' '--' ((Char - '-') | ('-' (Char - '-')))* '-->'

DTDName

public static final int DTDName

DTDName ::= name

ElemDeclName

public static final int ElemDeclName

ElemDeclName ::= name

elementdecl

public static final int elementdecl

elementdecl ::= '<' '!ELEMENT' S ElemDeclName S contentspec S? '>'

EmptyElemTag

public static final int EmptyElemTag

EmptyElemTag ::= '<' STagName (S Attribute)* S? '/' '>'

EntityDecl

public static final int EntityDecl

EntityDecl ::= '<' '!' ENTITY' S EntityDeclName S EntityDef S? '>'

| '<' '!' ENTITY' S '%' S EntityDeclName S PEDef S? '>'

EntityDef ::= EntityValue | (ExternalID NDataDecl?)

PEDef ::= EntityValue | ExternalID

EntityDeclName

public static final int EntityDeclName

EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'

| "'" ([^%&'] | PEReference | Reference)* "'"

EntityValue

public static final int EntityValue

EntityDeclName ::= Name

ETag

public static final int ETag

ETag ::= '<' '/' ETagName S? '>'

ETagName

public static final int ETagName

ETagName ::= Name

ExternalID

public static final int ExternalID

ExternalID ::= 'SYSTEM' S SystemLiteral

| 'PUBLIC' S PubidLiteral S SystemLiteral

NotationDecl

public static final int NotationDecl

NotationDecl ::= '<' '!NOTATION' S Name S (ExternalID | PublicID) S? '>'

PI

public static final int PI

PI ::= '<' '?' PITarget (S (Char* - (Char* '?>' Char*)))? '?' '>'

PITarget

public static final int PITarget

PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))

Reference

public static final int Reference

Reference ::= EntityRef | CharRef | PEReference

EntityRef ::= '&' Name ';'

PEReference ::= '%' Name ';'

CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';

STag

public static final int STag

STag ::= '<' STagName (S Attribute)* S? '>'

STagName

public static final int STagName

STagName ::= Name

TextDecl

public static final int TextDecl

TextDecl ::= '<' '?' 'xml' VersionInfo? EncodingDecl S? '?>'

XMLDecl

public static final int XMLDecl

XMLDecl ::= '<' '?' 'xml' VersionInfo EncodingDecl? SDDecl? S? '?' '>'


Methods

token(int, String)

Description

The interface call-back method. Receives an XML token and it's corresponding value

Syntax

public void token(int token, java.lang.String value)

Parameters

token - The XML token constant as specified in the interface.

value - The corresponding substring from the parsed text.


XMLTokenizer

Description

This class implements an eXtensible Markup Language (XML) 1.0 parser according to the World Wide Web Consortium (W3C) recommendation.

Syntax

public class XMLTokenizer
 
oracle.xml.parser.v2.XMLTokenizer


Constructors

XMLTokenizer()

Description

Creates a new Tokenizer object.

Syntax

public  XMLTokenizer()

XMLTokenizer(XMLToken)

Description

Creates a new Tokenizer object.

Syntax

public  XMLTokenizer(XMLToken handler)

Methods

parseDocument()

Description

Document ::= Prolog Element Misc*

Syntax

public void parseDocument()

setErrorHandler(ErrorHandler)

Description

Applications can use this to register a new error event handler. This replaces any previous setting for error handling.

Syntax

public void setErrorHandler(org.xml.sax.ErrorHandler handler)

Parameters

handler - ErrorHandler being registered

setErrorStream(OutputStream)

Description

Register a output stream for errors

Syntax

public void setErrorStream(java.io.OutputStream out)

setToken(int, boolean)

Description

Applications can use this to register a new token for XML tokenizer.

Syntax

public void setToken(int token, boolean val)

Parameters

token - XMLToken being set

setTokenHandler(XMLToken)

Description

Applications can use this to register a new XML tokenizer event handler.

Syntax

public void setTokenHandler(XMLToken handler)

Parameters

handler - XMLToken being registered

tokenize(InputSource)

Description

Tokenizes the XML from given input source

Syntax

public final void tokenize(org.xml.sax.InputSource in)

Parameters

in - the org.xml.sax.InputSouce to parse

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

tokenize(InputStream)

Description

Tokenizes the XML from given input stream.

Syntax

public final void tokenize(java.io.InputStream in)

Parameters

in - the InputStream containing XML data to parse.

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

See Also

XMLParser.setBaseURL(URL)

tokenize(Reader)

Description

Tokenizes the XML from given input stream.

Syntax

public final void tokenize(java.io.Reader r)

Parameters

r - the Reader containing XML data to parse.

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

See Also

XMLParser.setBaseURL(URL)

tokenize(String)

Description

Tokenizes the XML from the URL indicated

Syntax

public final void tokenize(java.lang.String in)

Parameters

in - the String containing the URL to parse from

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.

tokenize(URL)

Description

Tokenizes the XML document pointed to by the given URL and creates the corresponding XML document hierarchy.

Syntax

public final void tokenize(java.net.URL url)

Parameters

url - the url points to the XML document to parse.

Throws

XMLParseException - if syntax or other error encountered.

SAXException - Any SAX exception, possibly wrapping another exception.

IOException - IO Error.


JXDocumentBuilder

Description

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.

Syntax

public class JXDocumentBuilder
 
oracle.xml.jaxp.JXDocumentBuilder

Comments

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.

Since

JAXP 1.0

Methods

getDOMImplementation()

Description

The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.

Syntax

public org.w3c.dom.DOMImplementation getDOMImplementation()

Returns

The associated DOM implementation.

isNamespaceAware()

Description

Indicates whether or not this parser is configured to understand namespaces.

Syntax

public boolean isNamespaceAware()

isValidating()

Description

Indicates whether or not this parser is configured to validate XML documents.

Syntax

public boolean isValidating()

newDocument()

Description

Obtain a new instance of a DOM Document object to build a DOM tree with.

Syntax

public org.w3c.dom.Document newDocument()

parse(InputSource)

Description

Parse the content of the given input source as an XML document and return a new DOM Document object.

Syntax

public org.w3c.dom.Document parse(org.xml.sax.InputSource is)

Parameters

is - InputSource containing the content to be parsed.

Throws

IOException - If any IO errors occur.

SAXException - If any parse errors occur.

IllegalArgumentException - If the InputSource is null

See Also

org.xml.sax.DocumentHandler

setEntityResolver(EntityResolver)

Description

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.

Syntax

public void setEntityResolver(org.xml.sax.EntityResolver er)

setErrorHandler(ErrorHandler)

Description

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.

Syntax

public void setErrorHandler(org.xml.sax.ErrorHandler eh)

JXDocumentBuilderFactory

Description

Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents.

Syntax

public class JXDocumentBuilderFactory
 
oracle.xml.jaxp.JXDocumentBuilderFactory

Since

JAXP 1.0

Fields of JXDocumentBuilderFactory

Table 11-23 Fields of JXDocumentBuilderFactory
Field Syntax Description

BASE_URL

public static final java.lang.String BASE_URL

Base URL used in parsing entities.

DEBUG_MODE

public static final java.lang.String DEBUG_MODE

Sets Debug Mode - Boolean.TRUE or Boolean.FALSE

DTD_OBJECT

public static final java.lang.String DTD_OBJECT

DTD Object to be used for validation.

ERROR_ENCODING

public static final java.lang.String ERROR_ENCODING

Encoding for errors report via error stream (only if ERROR_STREAM is set)

ERROR_STREAM

public static final java.lang.String ERROR_STREAM

Error stream for reporting errors. The object can be OutputStream or PrintWriter. This attribute is ignored if ErrorHandler is set.

NODE_FACTORY

public static final java.lang.String NODE_FACTORY

Set NodeFactory to build custom Nodes

SCHEMA_OBJECT

public static final java.lang.String SCHEMA_OBJECT

Schema Object to be used for validation.

SHOW_WARNINGS

public static final java.lang.String SHOW_WARNINGS

Boolean to ignore warnings - Boolean.TRUE or Boolean.FALSE

USE_DTD_ONLY_FOR_VALIDATION

public static final java.lang.String USE_DTD_ONLY_FOR_VALIDATION

If true, DTD Object is used only for validation and is not added to the parser document


Constructors

JXDocumentBuilderFactory()

Description

Default Constructor

Syntax

public  JXDocumentBuilderFactory()

Methods

getAttribute(String)

Description

Allows the user to retrieve specific attributes on the underlying implementation.

Syntax

public java.lang.Object getAttribute(java.lang.String name)

Parameters

name - The name of the attribute.

Returns

value The value of the attribute.

Throws

IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

isExpandEntityReferences()

Description

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

Syntax

public boolean isExpandEntityReferences()

Returns

boolean

isIgnoringComments()

Description

Indicates whether or not the factory is configured to produce parsers which ignores comments. Always returns false - currently ignoring comments is not configurable

Syntax

public boolean isIgnoringComments()

Returns

boolean

isNamespaceAware()

Description

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

Syntax

public boolean isNamespaceAware()

Returns

boolean namespace awareness.

newDocumentBuilder()

Description

Creates a new instance of a DocumentBuilder using the currently configured parameters.

Syntax

public javax.xml.parsers.DocumentBuilder newDocumentBuilder()

Throws

ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested

setAttribute(String, Object)

Description

Allows the user to set specific attributes on the underlying implementation.

Syntax

public void setAttribute(java.lang.String name, java.lang.Object value)

Parameters

name - The name of the attribute.

value - The value of the attribute.

Throws

IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.


JXSAXParser

Description

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.

Syntax

public class JXSAXParser
 
oracle.xml.jaxp.JXSAXParser

Comments

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.

Since

JAXP 1.0

Methods

getParser()

Description

Returns the SAX parser that is encapsultated by the implementation of this class.

Syntax

public org.xml.sax.Parser getParser()

Comments

Deprecated, use getXMLReader()

getProperty(String)

Description

returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

Syntax

public java.lang.Object getProperty(java.lang.String name)

Parameters

name - The name of the property to be retrieved.

Returns

Value of the requested property.

Throws

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.

See Also

org.xml.sax.XMLReader#getProperty

getXMLReader()

Description

Returns the XMLReader that is encapsulated by the implementation of this class.

Syntax

public org.xml.sax.XMLReader getXMLReader()

isNamespaceAware()

Description

Indicates whether or not this parser is configured to understand namespaces.

Syntax

public boolean isNamespaceAware()

isValidating()

Description

Indicates whether or not this parser is configured to validate XML documents.

Syntax

public boolean isValidating()

setProperty(String, Object)

Description

Sets the particular property in the underlying implementation of org.xml.sax.XMLReader.

Syntax

public void setProperty(java.lang.String name, java.lang.Object value)

Parameters

name - The name of the property to be set.

value - The value of the property to be set.

Throws

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.

See Also

org.xml.sax.XMLReader#setProperty


JXSAXParserFactory

Description

Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents.

Syntax

public class JXSAXParserFactory
 
oracle.xml.jaxp.JXSAXParserFactory

Since

JAXP 1.0

Constructors

JXSAXParserFactory()

Description

Default Constructor

Syntax

public  JXSAXParserFactory()

Methods

getFeature(String)

Description

Returns the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

Syntax

public boolean getFeature(java.lang.String name)

Parameters

name - The name of the property to be retrieved.

Returns

Value of the requested property.

Throws

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.

See Also

org.xml.sax.XMLReader#getProperty

isNamespaceAware()

Description

Indicates whether or not the factory is configured to produce parsers which are namespace aware.

Syntax

public boolean isNamespaceAware()

newSAXParser()

Description

Creates a new instance of a SAXParser using the currently configured factory parameters.

Syntax

public javax.xml.parsers.SAXParser newSAXParser()

Throws

ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.

setFeature(String, boolean)

Description

Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.

Syntax

public void setFeature(java.lang.String name, boolean value)

Parameters

name - The name of the feature to be set.

value - The value of the feature to be set.

Throws

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.

See Also

org.xml.sax.XMLReader#setFeature


JXSAXTransformerFactory

Description

A JXTransformerFactory instance can be used to create Transformer and Templates objects.

Syntax

public class JXSAXTransformerFactory
 
oracle.xml.jaxp.JXSAXTransformerFactory

Comments

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.


Constructors

JXSAXTransformerFactory()

Description

The default constructor

Syntax

public  JXSAXTransformerFactory()

Methods

getAssociatedStylesheet(Source, String, String, String)

Description

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.

Syntax

public javax.xml.transform.Source 
getAssociatedStylesheet(javax.xml.transform.Source source, java.lang.String 
media, java.lang.String title, java.lang.String charset)

Comments

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.

Parameters

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.

Returns

A Source object suitable for passing to the TransformerFactory.

getAttribute(String)

Description

Allows the user to retrieve specific attributes on the underlying implementation.

Syntax

public java.lang.Object getAttribute(java.lang.String name)

Parameters

name - The name of the attribute.

Returns

value The value of the attribute.

Throws

IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

getErrorListener()

Description

Get the error event handler for the TransformerFactory.

Syntax

public javax.xml.transform.ErrorListener getErrorListener()

Returns

The current error handler, which should never be null.

getFeature(String)

Description

Look up the value of a feature. The feature name is any absolute URI.

Syntax

public boolean getFeature(java.lang.String name)

Parameters

name - The feature name, which is an absolute URI.

Returns

The current state of the feature (true or false).

getURIResolver()

Description

Get the object that is used by default during the transformation to resolve URIs used in document(), xsl:import, or xsl:include.

Syntax

public javax.xml.transform.URIResolver getURIResolver()

Returns

The URIResolver that was set with setURIResolver.

newTemplates(Source)

Description

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)

Comments

Creating a Templates object allows the TransformerFactory to do detailed performance optimization of transformation instructions, without penalizing runtime transformation.

Parameters

source - An object that holds a URL, input stream, etc.

Returns

A Templates object capable of being used for transformation purposes, never null.

Throws

TransformerConfigurationException - May throw this during the parse when it is constructing the Templates object and fails.

newTemplatesHandler()

Description

Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object.

Syntax

public javax.xml.transform.sax.TemplatesHandler newTemplatesHandler()

Returns

A non-null reference to a TransformerHandler, that may be used as a ContentHandler for SAX parse events.

Throws

TransformerConfigurationException - If for some reason the TemplatesHandler cannot be created.

newTransformer()

Description

Create a new Transformer object that performs a copy of the source to the result.

Syntax

public javax.xml.transform.Transformer newTransformer()

Parameters

source - An object that holds a URI, input stream, etc.

Returns

A Transformer object that may be used to perform a transformation in a single thread, never null.

Throws

TransformerConfigurationException - May throw this during the parse when it is constructing the Templates object and fails.

newTransformer(Source)

Description

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.

Syntax

public javax.xml.transform.Transformer newTransformer(javax.xml.transform.Source 
source)

Parameters

source - An object that holds a URI, input stream, etc.

Returns

A Transformer object that may be used to perform a transformation in a single thread, never null.

Throws

TransformerConfigurationException - May throw this during the parse when it is constructing the Templates object and fails.

newTransformerHandler()

Description

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.

Syntax

public javax.xml.transform.sax.TransformerHandler newTransformerHandler()

Returns

A non-null reference to a TransformerHandler, that may be used as a ContentHandler for SAX parse events.

Throws

TransformerConfigurationException - If for some reason the TransformerHandler cannot be created.

newTransformerHandler(Source)

Description

Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the transformation instructions specified by the argument.

Syntax

public javax.xml.transform.sax.TransformerHandler 
newTransformerHandler(javax.xml.transform.Source src)

Parameters

src - The Source of the transformation instructions.

Returns

TransformerHandler ready to transform SAX events.

Throws

TransformerConfigurationException - If for some reason the TransformerHandler can not be created.

newTransformerHandler(Templates)

Description

Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the Templates argument.

Syntax

public javax.xml.transform.sax.TransformerHandler 
newTransformerHandler(javax.xml.transform.Templates templates)

Parameters

templates - The compiled transformation instructions.

Returns

TransformerHandler ready to transform SAX events.

Throws

TransformerConfigurationException - If for some reason the TransformerHandler can not be created.

newXMLFilter(Source)

Description

Create an XMLFilter that uses the given Source as the transformation instructions.

Syntax

public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Source src)

Parameters

src - The Source of the transformation instructions.

Returns

An XMLFilter object, or null if this feature is not supported.

Throws

TransformerConfigurationException - If for some reason the TemplatesHandler cannot be created.

newXMLFilter(Templates)

Description

Create an XMLFilter, based on the Templates argument.

Syntax

public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Templates 
templates)

Parameters

templates - The compiled transformation instructions.

Returns

An XMLFilter object, or null if this feature is not supported.

Throws

TransformerConfigurationException - If for some reason the TemplatesHandler cannot be created.

setAttribute(String, Object)

Description

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.

Syntax

public void setAttribute(java.lang.String name, java.lang.Object value)

Parameters

name - The name of the attribute.

value - The value of the attribute.

Throws

IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

setErrorListener(ErrorListener)

Description

Set the error event listener for the TransformerFactory, which is used for the processing of transformation instructions, and not for the transformation itself.

Syntax

public void setErrorListener(javax.xml.transform.ErrorListener listener)

Parameters

listener - The new error listener.

Throws

IllegalArgumentException - if listener is null.

setURIResolver(URIResolver)

Description

Set an object that is used by default during the transformation to resolve URIs used in xsl:import, or xsl:include.

Syntax

public void setURIResolver(javax.xml.transform.URIResolver resolver)

Parameters

resolver - An object that implements the URIResolver interface, or null.


JXTransformer

Description

An instace of this class can transform a source tree into a result tree.

Syntax

public class JXTransformer
 
oracle.xml.jaxp.JXTransformer

Comments

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.


Constructors

JXTransformer()

Description

Constructs a JXTransformer object that uses the XSLStylesheet to transform the source.

Syntax

public  JXTransformer()

JXTransformer(XSLStylesheet)

Description

Constructor is based on

Syntax

public  JXTransformer(oracle.xml.parser.v2.XSLStylesheet templates)

Parameters

templates - a XSLStylesheet or Templates


Methods

clearParameters()

Description

Clear all parameters set with setParameter.

Syntax

public void clearParameters()

getErrorListener()

Description

Get the error event handler in effect for the transformation.

Syntax

public javax.xml.transform.ErrorListener getErrorListener()

Returns

The current error handler, which should never be null.

getOutputProperties()

Description

Get a copy of the output properties for the transformation.

Syntax

public java.util.Properties getOutputProperties()

Comments

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.

See Also

javax.xml.transform.OutputKeys, java.util.Properties

getOutputProperty(String)

Description

Get an output property that is in effect for the transformation.

Syntax

public java.lang.String getOutputProperty(java.lang.String name)

Comments

The property specified may be a property that was set with setOutputProperty, or it may be a property specified in the stylesheet.

Parameters

name - A non-null String that specifies an output property name, which may be namespace qualified.

Returns

The string value of the output property, or null if no property was found.

Throws

IllegalArgumentException - If the property is not supported.

See Also

javax.xml.transform.OutputKeys

getParameter(String)

Description

Get a parameter that was explicitly set with setParameter or setParameters.

Syntax

public java.lang.Object getParameter(java.lang.String name)

Parameters

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.

Returns

A parameter that has been set with setParameter, or null if a parameter with the given name was not found.

getURIResolver()

Description

Get an object that will be used to resolve URIs used in document(), etc.

Syntax

public javax.xml.transform.URIResolver getURIResolver()

Returns

An object that implements the URIResolver interface, or null.

setErrorListener(ErrorListener)

Description

Set the error event listener in effect for the transformation.

Syntax

public void setErrorListener(javax.xml.transform.ErrorListener listener)

Parameters

listener - The new error listener.

Throws

IllegalArgumentException - if listener is null.

setOutputProperties(Properties)

Description

Set the output properties for the transformation. These properties will override properties set in the Templates with xsl:output.

Syntax

public void setOutputProperties(java.util.Properties oformat)

Comments

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.

Parameters

oformat - A set of output properties that will be used to override any of the same properties in affect for the transformation.

Throws

IllegalArgumentException - if any of the argument keys are not recognized and are not namespace qualified.

See Also

javax.xml.transform.OutputKeys, java.util.Properties

setOutputProperty(String, String)

Description

Set an output property that will be in effect for the transformation.

Syntax

public void setOutputProperty(java.lang.String name, java.lang.String value)

Comments

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.

Parameters

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.

Throws

IllegalArgumentException - If the property is not supported, and is not qualified with a namespace.

See Also

javax.xml.transform.OutputKeys

setParameter(String, Object)

Description

Add a parameter for the transformation.

Syntax

public void setParameter(java.lang.String name, java.lang.Object value)

Comments

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.

Parameters

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.

setURIResolver(URIResolver)

Description

Set an object that will be used to resolve URIs used in document(). currently, we do not support URIResolver in document() fuction

Syntax

public void setURIResolver(javax.xml.transform.URIResolver resolver)

Comments

If the resolver argument is null, the URIResolver value will be cleared, and the default behavior will be used.

Parameters

resolver - An object that implements the URIResolver interface, or null.

transform(Source, Result)

Description

Process the source tree to the output result.

Syntax

public void transform(javax.xml.transform.Source xmlSource, 
javax.xml.transform.Result outputTarget)

Parameters

xmlSource - The input for the source tree.

outputTarget - The output target.

Throws

TransformerException - If an unrecoverable error occurs during the course of the transformation.


XSLT Processor Classes

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.

Table 11-24 Summary of XSLT Processor Classes  
Class Description

oraxsl Class

Provides a command-line interface to applying stylesheets on multiple XML documents.

XPathException Class

Indicates that an exception occurred during XSL tranformation.

XSLProcessor Class

Provides methods to transform an input XML document using a previously constructed XSLStylesheet.

XSLStylesheet Class

Holds XSL stylesheet information such as templates, keys, variables, and attribute sets.


oraxsl Class


Description of oraxsl

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.


Syntax of oraxsl

public class oraxsl extends java.lang.Object
 
java.lang.Object
  |
  +--oracle.xml.parser.v2.oraxsl


Usage of oraxsl

java oraxsl options* source? stylesheet? result?
Table 11-25 Commond-line options of oraxsl  
command description

-w

Show warnings

-e <error log>

A file to write errors to

-l <xml file list>

List of files to transform

-d <directory>

Directory with files to transform

-x <source extension>

Extensions to exclude

-i <source extension>

Extensions to include

-s <stylesheet>

Stylesheet to use

-r <result extension>

Extension to use for results

-o <result extension>

Directory to place results

-p <param list>

List of Params

-t <# of threads>

Number of threads to use

-v

Verbose mode


Methods of oraxsl

Table 11-26 Summary of Methods of oraxsl
Method Description

oraxsl(),

Class constructor

main(),

Invokes the oraxsl driver

oraxsl()

Description

Class constructor

Syntax

public  oraxsl()

main()

Description

Invokes the oraxsl driver

Syntax

public static void main(java.lang.String[] args)

Parameters

Table 11-27 Parameters of main()
Parameter Description

args

Command line arguments


XPathException Class

Description

Indicates that an exception occurred during XPath processing.

Syntax

public class XPathException extends oracle.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

Implemented Interfaces

java.io.Serializable

Methods

getErrorID()

Description

Syntax

public int getErrorID()

getMessage()

Description

Overrride getMessage, in order to construct error message from error id, and error params

Syntax

public java.lang.String getMessage()

Overrides

java.lang.Throwable.getMessage() in class java.lang.Throwable

getMessage(XMLError)

Description

Get localized message based on the XMLError sent as parameter

Syntax

public java.lang.String getMessage(XMLError err)

Parameters

err - XMLError class used to get the error message


XSLException Class


Description of XSLException

Indicates that an exception occurred during XSL tranformation

Syntax of XSLException

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


Direct Subclasses of XSLException

XPathException


Implemented Interfaces of XSLException

java.io.Serializable

Constructors of XSLException

XSLException()

Description

Syntax

public  XSLException(String mesg);

XSLExtensionElement Class


Description of XSLExtensionElement

Base element for extension elements


Syntax of XSLExtensionElement

public class XSLExtensionElement
 
oracle.xml.parser.v2.XSLExtensionElement


Methods of XSLExtensionElement

Table 11-28 Summary of Methods of XSLExtensionElement
Method Description

XSLExtensionElement()

Default Constructor

getAttributeTemplateValue()

Get an attribute value as template

getAttributeValue()

Get an attribute value

getChildNodes()

Gets the childNodes of the extension elements

processAction()

Function called to extecute the body of the extension elements

processContent()

Process contents of the extension element

XSLExtensionElement()

Description

Default Constructor

Syntax

public  XSLExtensionElement()

getAttributeTemplateValue()

Description

Get an attribute value as template

Syntax

protected final String getAttributeTemplateValue(      XSLTContext context, String namespace, String name)

Parameters

Table 11-29 Parameters of GetAttributeTempateValue
Parameter Description

context

XSLTContext

namespace

namespace of the attribute

name

name of the attribute

Returns

value of the attribute

getAttributeValue()

Description

Get an attribute value

Syntax

protected final String getAttributeValue(String namespace, String name);

Parameters

Table 11-30 Parameters of GetAttributeValue
Parameter Description

namespace

namespace of the attribute

name

name of the attribute

Returns

value of the attribute

getChildNodes()

Description

Gets the childNodes of the extension elements

Syntax

protected final java.util.Vector getChildNodes();

Returns

nodelist

processAction()

Description

Function called to extecute the body of the extension elements

Syntax

public void processAction(XSLTContext context);

Parameters

Table 11-31 Parameters of ProcessAction
Parameter Description

context

XSLTContext

processContent()

Description

Process contents of the extension element

Syntax

protected final void processContent(XSLTContext context);

Parameters

Table 11-32 Parameters of ProcessContent
Parameter Description

context

XSLTContext


XSLProcessor Class


Description of XSLProcessor

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.


Syntax of XSLProcessor

public class XSLProcessor
 
oracle.xml.parser.v2.XSLProcessor


Methods of XSLProcessor

Table 11-33 Summary of Methods of XSLProcessor  
Method Description

XSLProcessor()

Default constructor

getParam()

newXSLStylesheet()

Constructs an XSLStylesheet.

processXSL()

Transforms input XML document

removeParam()

Removes the value of a top-level stylesheet parameter.

resetParams()

Resets all the params set.

setBaseURL()

Set base url to resolve include/import hrefs.

setEntityResolver()

Set entity resolver to resolve include/import hrefs.

setErrorStream()

Creates an output stream for the output of warnings.

setLocale()

Applications can use this to set the locale for error reporting.

setParam()

Sets the value of a top-level stylesheet parameter.

showWarnings()

Set the overriding XSLOutput object.

showWarnings()

witch to determine whether to output warnings

XSLProcessor()

Description

Default Constructor

Syntax

public  XSLProcessor();

getParam()

Description

Gets the value of top-level stylesheet parameter.

Syntax

public java.lang.Object getParam(String uri, String name)

Parameters

uri - namespace URI of the parameter

name - local name of the paramter

Returns

The value of the parameter.

newXSLStylesheet()

Description

Constructs an XSLStylesheet. XSL function document('') is not supported as there is no way to re-access the input Stylesheet as XMLDocument.

Table 11-34 Versions of newXSLStylesheet()  
Syntax Description

public XSLStylesheet newXSLStylesheet( InputStream xsl);

Constructs an XSLStylesheet using the given Inputstream XSL

public XSLStylesheet newXSLStylesheet( Reader xsl);

Constructs an XSLStylesheet using the given Reader

public XSLStylesheet newXSLStylesheet( java.net.URL xsl);

Constructs an XSLStylesheet using the given URL

public XSLStylesheet newXSLStylesheet( XMLDocument xsl);

Constructs an XSLStylesheet using the given XMLDocument

Parameters

Table 11-35 Parameters of newXSLStylesheet()  
Parameter Description

xsl

XSL input

Returns

New XSL Stylesheet

Throws

XSLException on error.

processXSL()

Description

Transforms input XML document. The options are described in Table 11-36:

Table 11-36 Versions of processXSL()  
Syntax Description

public XMLDocumentFragment processXSL( XSLStylesheet xsl, InputStream xml, URL ref);

Transform input XML document using given InputStream and stylesheet.

public XMLDocumentFragment processXSL( XSLStylesheet xsl, Reader xml, URL ref);

Transform input XML document using given Reader and stylesheet.

public XMLDocumentFragment processXSL( XSLStylesheet xsl, URL xml, URL ref)

Transform input XML document using given URL and stylesheet.

public XMLDocumentFragment processXSL(XSLStylesheet xsl, XMLDocument xml)

Transform input XML document using given XMLDocument and stylesheet.

public void processXSL( XSLStylesheet xsl, XMLDocument xml, org.xml.sax.ContentHandler handler)

Transform input XML document using given XMLDocument and stylesheet.

public XMLDocumentFragment processXSL( XSLStylesheet xsl, XMLDocumentFragment xml)

Transform input XML document using given XMLDocument and stylesheet.

public void processXSL( XSLStylesheet xsl, XMLDocumentFragment xml, OutputStream os)

Transform input XML using given XMLDocumentFragment and stylesheet.

public void processXSL( XSLStylesheet xsl, XMLDocumentFragment xml, printWriter pw)

Transform input XML using given XMLDocumentFragment and stylesheet.

public void processXSL( XSLStylesheet xsl, XMLDocumentFragment xml, XMLDocumentHandler handlerXML)

Transform input XML document using given XMLDocument and stylesheet. As the result of XSLT is a document fragment, the following functions in XMLDocumentHandler will not be called: - setDocumentLocator, startDocument, endDocument, - setDoctype, endDoctype, setXMLDecl, setTextDecl

public void processXSL( XSLStylesheet xsl, XMLDocument xml, OutputStream out)

Transform input XML document using given XMLDocument and stylesheet.

public void processXSL( XSLStylesheet xsl, XMLDocument xml, java.io.PrintWriter pw)

ansform input XML document using given XMLDocument and stylesheet.

public void processXSL( XSLStylesheet xsl, XMLDocument xml, XMLDocumentHandler handlerXML)

Transform input XML document using given XMLDocument and stylesheet. The output of the transformation is reported through XMLDocumentHandler As the result of XSLT is a document fragment, the following functions in XMLDocumentHandler will not be called: - setDocumentLocator, startDocument, endDocument, - setDoctype, endDoctype, setXMLDecl, setTextDecl

public XMLDocumentFragment processXSL( XSLStylesheet xsl, XMLElement inp)

Transform input XML document using given XMLDocument and stylesheet.

public void processXSL( XSLStylesheet xsl, XMLElement inp, org.xml.sax.ContentHandler handler)

Transform input XML document using given XMLElement and stylesheet. The output of the transformation is reported through ContentHandler As the result of XSLT is a document fragment, the following functions in ContentHandler will not be called: - setDocumentLocator, startDocument, endDocument,

public void processXSL( XSLStylesheet xsl, XMLElement xml, OutputStream out)

Transform input XML using given XMLElement and stylesheet.

public void processXSL( XSLStylesheet xsl, XMLElement xml, PrintWriter pw)

Transform input XML using given XMLElement and stylesheet

public void processXSL( XSLStylesheet xsl, XMLElement xml, XMLDocumentHandler handlerXML)

Transform input XML document using given XMLElement and stylesheet. As the result of XSLT is a document fragment, the following functions in XMLDocumentHandler will not be called: - setDocumentLocator, startDocument, endDocument, - setDoctype, endDoctype, setXMLDecl, setTextDecl

Parameters

Table 11-37 Parameters of processXSL  
Parameter Description

xsl

XSLStylesheet to be used for transformation

xml

XML input to be transformed

ref

Reference URL to resolve external entities in input xml file

handler

Content handler

out

Output stream to which the result is printed

pw

PrintWriter to which the result is printed

handlerXML

XMLDocument handler

Returns

XMLDocumentFragment or void, depending on form of the function.

Throws

XSLException on error.

removeParam()

Description

Removes the value of a top-level stylesheet parameter.

Syntax

public void removeParam(String uri, String name)

Parameters

Table 11-38 Parameters of removeParam
Parameter Description

uri

URI of parameter

name

parameter name

Throws

XSLException on error

resetParams()

Description

Resets all the params set.

Syntax

public void resetParams()

Throws

XSLException on error

setBaseURL()

Description

Set base url to resolve include/import hrefs. EntityResolver if set is used before using the base url. See also setEntityResolver().

Syntax

public void setBaseURL(java.net.URL url)

Parameters

Table 11-39 Parameters of setBaseURL
Parameter Description

url

Base URL to be set

setEntityResolver()

Description

Set entity resolver to resolve include/import hrefs. If not set, base url (if set) is used.

Syntax

public void setEntityResolver(org.xml.sax.EntityResolver eResolver)

Parameters

Table 11-40 Parameters of setEntityResolver
Parameter Description

eResolver

Entity resolver

setErrorStream()

Description

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.

Syntax

public final void setErrorStream(java.io.OutputStream out)

Parameters

Table 11-41 Parameters of setErrorStream
Parameter Description

out

The output stream to use for errros and warnings

setLocale()

Description

Applications can use this to set the locale for error reporting.

Syntax

public void setLocale(java.util.Locale locale)

Parameters

Table 11-42 Parameters of setLocale
Parameter Description

locale

Locale to set

setParam()

Description

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.

Syntax

public void setParam(String uri, String name, Object value)

Parameters

Table 11-43 Parameters of setParam
Parameter Description

uri

URI of parameter

name

Parameter name

value

Parameter value; Strings are treated as XPath Expr for backward compatibility)

Throws

XSLException on error

showWarnings()

Description

Switch to determine whether to output warnings.

Syntax

public final void showWarnings(boolean flag)

Parameters

Table 11-44 Parameters of showWarnings
Parameter Description

flag

Determines whether warning should be shown; default: warnings not output


XSLStylesheet Class


Description of XSLStylesheet

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.


Syntax of XSLStylesheet

public class XSLStylesheet
 
oracle.xml.parser.v2.XSLStylesheet


Fields of XSLStylesheet

Table 11-45 Fields of XSLStylesheet
Field Syntax Description

output

public oracle.xml.parser.v2.XSLOutput output


Methods of XSLStylesheet

Table 11-46 Summary of Methods of XSLStylesheet  
Method Description

getDecimalFormat()

Get the decimal format symbols specified in the stylesheet

getOutputEncoding()

Get the value of the encoding specified in xsl:output

getOutputMediaType()

Get the value of the media-type specified in xsl:output

getOutputProperties()

newTransformer()

XSLTContext Class

Removes the value of a top-level stylesheet parameter.

XSLTContext Class

Resets all the params set.

XSLTContext Class

Sets the value of a top-level stylesheet parameter.

getDecimalFormat()

Description

Get the decimal format symbols specified in the stylesheet

Syntax

public java.text.DecimalFormatSymbols getDecimalFormat(NSName nsname)

Parameters

Table 11-47 Parameters of getDecimalFormat
Parameter Description

nsname

Qualified name from xsl decimal-format

Returns

DecimalFormatSymbols

getOutputEncoding()

Description

Get the value of the encoding specified in xsl:output

Syntax

public java.lang.String getOutputEncoding()

Returns

The encoding

getOutputMediaType()

Description

Get the value of the media-type specified in xsl:output

Syntax

public java.lang.String getOutputMediaType()

Returns

the media type

getOutputProperties()

Description

Returns the output properties specified in xsl:output as java.util.Properties.

Syntax

public java.util.Properties getOutputProperties()

newTransformer()

Description

Returns a JAXP Transformer object that uses this stylesheet for transformation.

Syntax

public javax.xml.transform.Transformer newTransformer()

XSLTContext Class


Syntax of XSLTContext

public class XSLTContext extends java.lang.Object
 
java.lang.Object
  |
  +--oracle.xml.parser.v2.XSLTContext


Description of XSLTContext

Class for Xpath processing Context


Methods of XSLTContext

Table 11-48 Summary of Methods of XSLTContext
Method Description

getContextNode()

Get the current context node

getContextPosition()

Get the current context node position

getContextSize()

Get the current context size

getError()

Get the XMLError instance for reporting errors

getVariable()

Retrieve variable at the given stack offset

reportCharacters()

Report characters to the current output handler

reportNode()

Report a XMLNode to the current output handler

setError()

Set the XMLError

getContextNode()

Description

Get the current context node

Syntax

public XMLNode getContextNode()

Returns

XMLNode current context node

getContextPosition()

Description

Get the current context node position

Syntax

public int getContextPosition()

Returns

int current context node position

getContextSize()

Description

Get the current context size

Syntax

public int getContextSize()

Returns

int current context size

getError()

Description

Get the XMLError instance for reporting errors

Syntax

public XMLError getError()

Returns

XMLError

getVariable()

Description

Retrieve variable at the given stack offset

Syntax

public getVariable(NSName name, int offset)

Parameters

Table 11-49 Parameters of getVariable
Parameter Description

name

name of the variable

offset

offset of the variable

reportCharacters()

Description

Report characters to the current output handler

Syntax

public void reportCharacters(String data, boolean disableoutesc)

Parameters

Table 11-50 Parameters of reportCharcters
Parameter Description

chars

String to be printed

disableoutesc

Boolean to disable or enable escaping of characters as defined in the W3C.org XML 1.0 specification. TRUE means disabled, FALSE means enabled.

reportNode()

Description

Report a XMLNode to the current output handler

Syntax

public void reportNode(XMLNode node)

Parameters

Table 11-51 Parameters of reportNode
Parameter Description

node

node to be output

setError()

Description

Set the XMLError

Syntax

public void setError(XMLError err)

Parameters

Table 11-52 Parameters of setError
Parameter Description

err

instance of XMLError


Go to previous page Go to next page
Oracle
Copyright © 1996, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback