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 setErrorHandle