Oracle9i XML API Reference - XDK and Oracle XML DB Release 2 (9.2) Part Number A96616-01 |
|
An XML document can be viewed as a tree whose nodes consisting of information between start-tags and end-tags. This tree representation, or the Document Object Model (DOM), is formed in memory when the XML parser parses a document. The DOM APIs are contained in the oracle.xml.parser.v2 package.
This chapter discusses the APIs for accessing and navigating this tree and includes the following sections:
public interface NSResolver
This interface provides support for resolving Namespaces.
XMLElement
Finds and returns the namespace definition in scope for a given namespace prefix; returns null if prefix could not be resolved.
public String resolveNamespacePrefix( String prefix);
Parameter | Description |
---|---|
prefix |
Namespace prefix to be resolved. |
The PrintDriver
interface defines methods used to print XML documents represented as DOM trees.
public interface PrintDriver
XMLPrintDriver
Closes the output stream or print writer
public void close();
Flushes the output stream or print writer
public void flush();
Prints an XMLAttr
node
public void printAttribute( XMLAttr
attr);
Parameter | Description |
---|---|
attr |
The XMLAttr node. |
Calls print method for each attribute of the XMLElement.
public void printAttributeNodes( XMLElement
elem);
Parameter | Description |
---|---|
elem |
The elem whose attributes are to be printed. |
Prints an XMLCDATA
node.
public void printCDATASection( XMLCDATA
cdata);
Parameter | Description |
---|---|
cdata |
The XMLCDATA node. |
Calls print method for each child of the XMLNode
public void printChildNodes( XMLNode
node);
Parameter | Description |
---|---|
node |
The node whose children are to be printed. |
Prints an XMLComment
node.
public void printComment( XMLComment
comment);
Parameter | Description |
---|---|
comment |
The comment node. |
Prints a DTD
.
public void printDoctype( DTD
dtd);
Parameter | Description |
---|---|
dtd |
The DTD to be printed. |
Prints an XMLDocument
.
public void printDocument( XMLDocument
doc);
Parameter | Description |
---|---|
doc |
The document to be printed. |
Prints an empty XMLDocumentFragment
object.
public void printDocumentFragment( XMLDocumentFragment
dfrag);
Parameter | Description |
---|---|
dfrag |
The document fragment to be printed. |
Prints an XMLElement
.
public void printElement( XMLElement
elem);
Parameter | Description |
---|---|
elem |
The element to be printed. |
Prints an XMLEntityReference
node.
public void printEntityReference( XMLEntityReference
eref);
Parameter | Description |
---|---|
eref |
The XMLEntityReference node to be printed. |
Prints an XMLPI
node.
public void printProcessingInstruction( XMLPI
pi);
Parameter | Description |
---|---|
pi |
The XMLPI node to be printed. |
Prints an XMLText
node.
public void printTextNode( XMLText
text);
Parameter | Description |
---|---|
text |
The text node. |
Sets the encoding of the print driver.
public void setEncoding( String enc);
Parameter | Description |
---|---|
enc |
The encoding of the document being printed. |
This class hold information about each attribute declared in an attribute list in the Document Type Definition.
public class AttrDecl implements java.io.Externalizable oracle.xml.parser.v2.AttrDecl
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/ decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public static final int REQUIRED public AttrDecl();
Returns attribute presence.
public int getAttrPresence();
Returns attribute type.
public int getAttrType();
Returns attribute default value.
public String getDefaultValue();
Returns attribute values as an Enumeration
.
public java.util.Vector getEnumerationValues();
Returns the name of the Attr Decl.
public String getNodeName();
Returns a code representing the type of the underlying object.
public short getNodeType();
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. Throws:
IOException
is thrown when there is an error in reading the input stream.ClassNotFoundException
is thrown when the class is not foundpublic void readExternal( java.io.ObjectInput i);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Returns a string representation of the attribute type.
public static String typeToString( int type);
Parameter | Description |
---|---|
type |
Numerical representation of the attribute type. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the serialized/compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the serialized/ compressed stream. |
Implements the DOM DocumentType interface and holds the Document Type. Definition information for an XML document.
public class DTD implements java.io.Externalizable oracle.xml.parser.v2.DTD
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public DTD();
Finds and returns an element declaration for the given tag name.
public final ElementDecl
findElementDecl( String name);
Parameter | Description |
---|---|
name |
The tag name. |
Finds and returns a named entity in the DTD; returns null if it is not found.
public final org.w3c.dom.Entity findEntity( String n, boolean par);
Parameter | Description |
---|---|
n |
The name of the entity. |
par |
Boolean indicating if the entity is parameter Entity. |
Retrieves the named notation from the DTD; returns null if it is not found.
public final org.w3c.dom.Notation findNotation( String name);
Parameter | Description |
---|---|
name |
The name of the notation. |
Return a NodeList
that contains all children of this node. If there are no children, this is a NodeList
containing no nodes. The content of the returned NodeList
is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList
accessors; it is not a static snapshot of the content of the node. This is true for every NodeList
, including the ones returned by the getElementsByTagName
method.
public org.w3c.dom.NodeList getChildNodes();
Returns a NamedNodeMap
containing the element declarations in the DTD. Every node in this map is an ElementDecl
object. The element declarations in the DTD The DOM Level 1 does not support editing ElementDecl, therefore ElementDecl
cannot be altered in any way.
public org.w3c.dom.NamedNodeMap getElementDecls();
Returns a NamedNodeMap
containing the general entities, both external and internal, declared in the DTD. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY % baz "baz">]> <ex/> the interface provides access to foo
and bar
but not baz
. Every node in this map also implements the Entity
interface. The DOM Level 1 does not support editing entities, therefore entities
cannot be altered in any way.
public org.w3c.dom.NamedNodeMap getEntities();
Returns the internal subset of the DTD.
public String getInternalSubset();
Returns the name of the DTD, or the name immediately following the DOCTYPE
keyword.
public String getName();
Returns the name of the DTD; or the name immediately following the DOCTYPE
keyword.
public String getNodeName();
Returns a code representing the type of the underlying object.
public short getNodeType();
Returns a NamedNodeMap
containing the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements the Notation
interface. The DOM Level 1 does not support editing notations, therefore notations
cannot be altered in any way.
public org.w3c.dom.NamedNodeMap getNotations();
Returns the owner of the DTD implementation.
public XMLDOMImplementation
getOwnerImplementation();
Returns the public identifier associated with the DTD, if specified. If the public identifier was not specified, this is null
.
public String getPublicId();
Returns the root tag for the DTD.
public String getRootTag();
Returns the system identifier associated with the DTD, if specified. If the system identifier was not specified, this is null
.
public String getSystemId();
Determines whether a node has any children; return false always, as DTD cannot have any overrides method in XMLNode.
public boolean hasChildNodes();
Normalizes the DTD.
public void normalize();
Writes the contents of this document to the given output. Throws IOException
if an invalid encoding is specified or another error occurs. The options are described in the following table.
Parameter | Description |
---|---|
out |
The output. |
enc |
Encoding used for the output. |
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not found.public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Set the root tag for the DTD
public void setRootTag( String root);
Parameter | Description |
---|---|
root |
The root tag. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the serialized/compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the serialized/ compressed stream. |
This class represents an element declaration in a DTD.
public class ElementDecl implements java.io.Serializable, java.io.Externalizable oracle.xml.parser.v2.ElementDecl
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public ElementDecl();
Returns a duplicate of this node; serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode
returns null
.). Cloning an Element
copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text
node. Cloning any other type of node simply returns a copy of this node.
public org.w3c.dom.Node cloneNode(boolean deep);
Parameter | Description |
---|---|
deep |
If |
Returns vector of element names that can be appended to the element.
public java.util.Vector expectedElements( org.w3c.dom.Element e);
Parameter | Description |
---|---|
e |
Element. |
Returns an attribute declaration object or null if not found
public final AttrDecl
findAttrDecl( String name);
Parameter | Description |
---|---|
name |
The attribute declaration to find. |
Returns an enumeration of attribute declarations.
public org.w3c.dom.NamedNodeMap getAttrDecls();
Returns a vector of elements that can be appended to this element.
public final java.util.Vector getContentElements();
Returns the content model of element.
public int getContentType();
Returs the name of the Element Decl.
public String getNodeName();
Returns a code representing the type of the underlying object.
public short getNodeType();
Returns the root node of Content Model Parse Tree. Node.getFirstChild()
and Node.getLastChild()
return the parse tree branches. Node.getNodeType()
and Node.getNodeName()
return the parse tree node type and name.
public final org.w3c.dom.Node getParseTree();
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not found.public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Validates the content of a element node; returns TRUE
if valid, FLASE
otherwise.
public boolean validateContent(org.w3c.dom.Element e);
Parameter | Description |
---|---|
e |
Element node to validate. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the serialized/compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the serialized/ compressed stream. |
This class implements the DOM Attr interface and holds information on each attribute of an element. See also Attr, NodeFactory, DOMParser.setNodeFactory()
.
public class XMLAttr implements oracle.xml.parser.v2.NSName
,
java.io.Externalizable
oracle.xml.parser.v2.XMLAttr
java.io.Externalizable, NSName
, oracle.xml.util.NSName, java.io.Serializable
Adds text to the XMLNode.
public XMLNode
addText( String str);
Parameter | Description |
---|---|
str |
Text added. |
Returns a duplicate of this node; serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode
returns null
.). Cloning an Element
copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text
node. Cloning any other type of node simply returns a copy of this node.
public org.w3c.dom.Node cloneNode( boolean deep);
Parameter | Description |
---|---|
deep |
If |
Returns the fully resolved Name for this attribute.
public String getExpandedName();
Returns the local name of this attribute.
public String getLocalName();
Returns the attribute name.
public String getName();
Returns the namespace of the attribute.
public String getNamespaceURI();
Returns the next attribute, if any.
public XMLAttr
getNextAttribute();
Returns the next sibling, if any.
public org.w3c.dom.Node getNextSibling();
Returns a code representing the type of the underlying object.
public short getNodeType();
Returns the value of this node, depending on its type. Throws DOMException
:
DOMString
variable on the implementation platform.public String getNodeValue();
Returns the element which owns this attribute.
public org.w3c.dom.Element getOwnerElement();
Returns the parent of this node. All nodes, except Document
, DocumentFragment
, and Attr
may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null
.
public org.w3c.dom.Node getParentNode();
Returns the name space prefix of the element.
public String getPrefix();
Returns the previous sibling, if any.
public org.w3c.dom.Node getPreviousSibling();
Returns TRUE
if the attribute was specified explicitly in the element, FALSE
otherwise.
public boolean getSpecified();
Returns the attribute value.
public String getValue();
Restores the information written by writeExternal. Throws the following exceptions:
IOException
when there is an exception while reading the compressed stream.ClassNotFoundException
when the class is not foundpublic void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used to read the compressed stream. |
Sets the value of this node, depending on its type. Throws DOMException
:
DOMString
variable on the implementation platform.public void setNodeValue( String nodeValue);
Parameter | Description |
---|---|
nodeValue |
The value of the node to be set. |
Sets the value.
public void setValue( String val);
Parameter | Description |
---|---|
val |
The value to set. |
Saves the state of the object in a binary compressed stream. Throws IOException
when there is an exception while writing the compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the compressed stream. |
This class implements the DOM CDATASection interface. See also CDATASection, NodeFactory, DOMParser.setNodeFactory(NodeFactory)
.
public class XMLCDATA implements java.io.Externalizable oracle.xml.parser.v2.XMLCDATA
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public XMLCDATA();
Returns the name of the node.
public String getNodeName();
Returns a code representing the type of the underlying object.
public short getNodeType();
Reads the information written in the compressed stream by writeExternal()
method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not found.public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the compressed stream. |
This class implements the DOM Comment interface. See also Comment
, NodeFactory
, DOMParser.setNodeFactory().
public class XMLComment implements java.io.Externalizable oracle.xml.parser.v2.XMLComment
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public XMLComment();
Adds the comment text.
public XMLNode
addText( String str);
Parameter | Description |
---|---|
str |
The comment text. |
Returns a name of the node.
public String getNodeName();
Returns a code representing the type of the underlying object.
public short getNodeType();
Reads the information written in the compressed stream by writeExternal()
method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not foundpublic void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Reports SAX Events from a DOM Tree. Throws SAXException
.
public void reportSAXEvents( org.xml.sax.ContentHandler cntHandler);
Parameter | Description |
---|---|
cntHandler |
Content handler. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the compressed stream. |
This class implements the XML Decl Processing Instruction. See also XMLPI Class.
public class XMLDeclPI extendsoracle.xml.parser.v2.XMLPI
implements java.io.Externalizableoracle.xml.parser.v2.XMLPI
| +--oracle.xml.parser.v2.XMLDeclPI
java.io.Externalizable, java.io.Serializable
Creates a new instance of XMLDeclPI. The options are described in the following table.
Returns a duplicate of this node; serves as a generic copy constructor.
public org.w3c.dom.Node cloneNode( boolean deep);
Parameter | Description |
---|---|
deep |
If |
Returns the fully constructed string 'version=1.0 ....' Throws DOMException
:
DOMString
variable on the implementation platform.public String getData();
Returns the character encoding information, or the encoding information stored in the <?xml ...?> tag or the user-defined output encoding if it has been more recently set.
public final String getEncoding();
Returns the value of this node. Throws DOMException
:
DOMString
variable on the implementation.public String getNodeValue();
Returns the standalone information, or the standalone attribute stored in the <?xml ...?> tag.
public final String getStandalone();
Retrieves the version information, or the version number stored in the <?xml ...?> tag.
public final String getVersion();
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not foundpublic void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Sets the character encoding for output. 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.
public final void setEncoding( String encoding);
Parameter | Description |
---|---|
encoding |
The character encoding to set. |
Sets the standalone information stored in the <?xml ...?> tag
public final boolean setStandalone( String value);
Parameter | Description |
---|---|
value |
Specifies if the XMLDeclPI class is standalone: |
Sets the version number stored in the <?xml ...?> tag.
public final void setVersion( String version);
Parameter | Description |
---|---|
version |
The version information to set. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the compressed stream. |
This class implements the DOM Document interface, represents an entire XML document and serves the root of the Document Object Model tree. Each XML tag can either represent a node or a leaf of this tree.
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.
public class XMLDocument implements java.io.Externalizable oracle.xml.parser.v2.XMLDocument
java.io.Externalizable, java.io.Serializable
Creates an empty document.
public XMLDocument();
Adds an ID Element associated with this document.
public void addID( String name,
XMLElement
e);
Parameter | Description |
---|---|
id |
The id value. |
e |
XMLElement associated with id. |
Adopts a node from another document to this document. The returned node has no parent; parentNode is null. The source node is removed from the original document. Throws DOMException
public org.w3c.dom.Node adoptNode( org.w3c.dom.Node srcNode);
Parameter | Description |
---|---|
srcNode |
Node to be adopted. |
Appends a new node to the document. Throws DOMException
:
elem
node.elem
was created from a different document than this one.public org.w3c.dom.Node appendChild( org.w3c.dom.Node newNode);
Parameter | Description |
---|---|
newNode |
The new node to be added. |
Returns a duplicate of this node; serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode
returns null
.). Cloning an Element
copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text
node. Cloning any other type of node simply returns a copy of this node.
public org.w3c.dom.Node cloneNode( boolean deep);
Parameter | Description |
---|---|
deep |
If |
Creates an Attr
of the given name. Note that the Attr
instance can then be set on an Element
using the setAttribute
method. Throws DOMException
:
public org.w3c.dom.Attr createAttribute( String name);
Parameter | Description |
---|---|
name |
The name of the new attribute. |
Creates an attribute with the given qualified name and namespace URI. Throws DOMException
:
public org.w3c.dom.Attr createAttributeNS( String namespaceURI, String qualifiedName);
Parameter | Description |
---|---|
namespaceURI |
Namespace of the attribute/element to be created. |
qualifiedName |
Qualified name of the attribute/element to be created. |
Creates a CDATASection
node whose value is the specified string. Throws DOMException
.
public org.w3c.dom.CDATASection createCDATASection( String data);
Parameter | Description |
---|---|
data |
The data for the CDATASection contents. |
Creates a Comment
node given the specified string.
public org.w3c.dom.Comment createComment( String data);
Parameter | Description |
---|---|
data |
The data for the node. |
Creates an empty DocumentFragment
object.
public org.w3c.dom.DocumentFragment createDocumentFragment();
Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object. Throws DOMException
:
public org.w3c.dom.Element createElement( String tagName);
Parameter | Description |
---|---|
tagName |
The name of the element type to instantiate. The name is treated as case-sensitive. |
Creates an element of the given qualified name and namespace URI. Throws DOMException
:
public org.w3c.dom.Element createElementNS( String namespaceURI, String qualifiedName);
Parameter | Description |
---|---|
namespaceURI |
Namespace of the attribute/element to be created. |
qualifiedName |
Qualified name of the attribute/element to be created. |
Creates an EntityReference object. Throws DOMException
:
public org.w3c.dom.EntityReference createEntityReference( String name);
Parameter | Description |
---|---|
name |
The name of the entity to reference. |
Creates an event object of the specified type.
public org.w3c.dom.events.Event createEvent( String type);
Parameter | Description |
---|---|
type |
The type of the event. |
Creates a Mutation Event object of specified type.
public org.w3c.dom.events.MutationEvent createMutationEvent( String type);
Parameter | Description |
---|---|
type |
The type of the mutation event. |
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. Throws DOMException
:
public org.w3c.dom.traversal.NodeIterator createNodeIterator( org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean expandEntityReferences);
Creates a ProcessingInstruction
node given the specified name and data strings. Throws DOMException
:
public org.w3c.dom.ProcessingInstruction createProcessingInstruction( String target, String data);
Parameter | Description |
---|---|
target |
The target part of the processing instruction. |
data |
The data for the node. |
Creates a new Document Range Object, with Start and End Boundary points at the beginning of the document.
public org.w3c.dom.ranges.Range createRange();
Creates a Range Event object of specified type.
public org.w3c.dom.events.Event createRangeEvent( String type);
Parameter | Description |
---|---|
type |
The type of the Range event. |
Creates a Text
node given the specified string.
public org.w3c.dom.Text createTextNode( String data);
Parameter | Description |
---|---|
data |
The data of the node. |
Creates a Traversal Event object of specified type.
public org.w3c.dom.events.Event createTraversalEvent( String type);
Parameter | Description |
---|---|
type |
The type of the traversal event. |
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. Throws DOMException
:
public org.w3c.dom.traversal.TreeWalker createTreeWalker( org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean expandEntityReferences);
Returns vector of element names that can be appended to the element.
public java.util.Vector expectedElements( org.w3c.dom.Element e);
Parameter | Description |
---|---|
e |
Element |
Returns column number debug information.
public int getColumnNumber();
Returns the debug flag.
public boolean getDebugMode();
Returns the Document Type Declaration (DTD) associated with this document. For XML documents without a DTD, this returns null
. Note that the DOM Level 1 specification does not support editing the DTD.
public org.w3c.dom.DocumentType getDoctype();
Accesses the child node that is the root element of the document.
public org.w3c.dom.Element getDocumentElement();
Returns the Element whose ID is given by elementId. If no such element exists, returns null. Behavior is not defined if more than one element has this ID.
public org.w3c.dom.Element getElementById( String elementId);
Parameter | Description |
---|---|
elementId |
The elementId used to get the matching Id Element. |
Returns a NodeList
of all the Element
s with a given tag name in the order in which they would be encountered in a preorder traversal of the Document
tree.
public org.w3c.dom.NodeList getElementsByTagName( String tagname);
Parameter | Description |
---|---|
tagname |
The name of the tag to match on. The special value "*" matches all tags. |
Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree.
public org.w3c.dom.NodeList getElementsByTagNameNS( String namespaceURI, String localName);
Parameter | Description |
---|---|
namespaceURI |
Namespace of the elements requested. |
localName |
Local name of the element requested. |
Returns the character encoding information stored in the <?xml ...?> tag or the user-defined output encoding if it has been more recently set.
public final String getEncoding();
Returns the ID element hashtable in the XML DOM Tree.
public java.util.Hashtable getIDHashtable();
Returns the DOMImplementation
object that handles this document. A DOM application may use objects from multiple implementations.
public org.w3c.dom.DOMImplementation getImplementation();
Returns line number debug information.
public int getLineNumber();
Returns a code representing the type of the underlying object.
public short getNodeType();
Returns the Document
object associated with this node. Since this node is a Document,
this is null
.
public org.w3c.dom.Document getOwnerDocument();
Retrieves the standalone information; this is the standalone attribute stored in the <?xml ...?> tag.
public final String getStandalone();
Returns the system id of the entity contain this node.
public String getSystemId();
Returns the non-marked-up text contained by this element. For text elements, this is the raw data. For elements with child nodes, this method traverses the entire subtree and appends the text for each terminal text element, effectively stripping out the XML markup for the subtree. For example, if the XML document contains "William Shakespeare", XMLDocument.getText
returns "William Shakespeare".
public String getText();
Retrieves the version information stored in the <?xml ...?> tag.
public final String getVersion();
Imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is 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. Throws DOMException
:
public org.w3c.dom.Node importNode( org.w3c.dom.Node importedNode, boolean deep);
Parameter | Description |
---|---|
importedNode |
Node to be imported. |
deep |
Indicates whether the descen.dants of this node are to be imported. |
Inserts the node newChild
before the existing child node refChild
. If refChild
is null
, insert newChild
at the end of the list of children. If newChild
is a DocumentFragment
object, all of its children are inserted, in the same order, before refChild
. If the newChild
is already in the tree, it is first removed. Throws DOMException
:
newChild
node, or if the node to insert is one of this node's ancestors.newChild
was created from a different document than the one that created this node.refChild
is not a child of this node.public org.w3c.dom.Node insertBefore( org.w3c.dom.Node newChild, org.w3c.dom.Node refChild);
Parameter | Description |
---|---|
newChild |
The node to insert. |
refChild |
The reference node, or the node before which the new node must be inserted. |
Writes the contents of this document to the given output. Throws IOException
. The options are described in the following table.
Parameter | Description |
---|---|
out |
Output to write to. |
enc |
Encoding to use for the output. |
pd |
PrintDriver used to write each node. |
Writes the contents of this document to the given output stream. Throws IOException
. The options are described in the following table.
Parameter | Description |
---|---|
out |
the output to write to. |
enc |
Encoding to use for the output. |
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. Throws the following exceptions:
IOException
thrown when there is an error in reading the input stream.ClassNotFoundException
thrown when the class is not found.public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Removes the elem from this documents list of child nodes. Throws DOMException:
oldChild
is not a child of this node.public org.w3c.dom.Node removeChild( org.w3c.dom.Node elem);
Parameter | Description |
---|---|
elem |
The element to be removed. |
Replaces the child node oldChild
with newChild
in the list of children, and returns the oldChild
node. If the newChild
is already in the tree, it is first removed. This is an override of the XMLNode.removeChild()
method. Throws DOMException
:
newChild
node.newChild
was created from a different document than this one.oldChild
is not a child of this node.public org.w3c.dom.Node replaceChild( org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild);
Parameter | Description |
---|---|
newChild |
The new node to put in the child list. |
oldChild |
he node being replaced in the list. |
Reports SAX Events from a DOM Tree. Throws a SAXException
.
public void reportSAXEvents( org.xml.sax.ContentHandler cntHandler);
Parameter | Description |
---|---|
cntHandler |
The content handler. |
Sets the doctype URI for the document.
public void setDoctype( String rootname, String sysid, String pubid);
Parameter | Description |
---|---|
root |
The name of the root element. |
sysid |
The system id of the doctype. |
pubid |
The public id of the doctype (can be null). |
Sets the character encoding for output. Eventually it sets the ENCODING stored in the <?xml ...?> tag, but not until the document is saved. This method should not be called until the Document has been loaded.
public final void setEncoding( String encoding);
Parameter | Description |
---|---|
encoding |
The character encoding to set. |
Sets the locale for error reporting.
public final void setLocale( java.util.Locale locale);
Parameter | Description |
---|---|
locale |
Locale for error reporting. |
Sets node context.
public void setNodeContext( oracle.xml.util.NodeContext nctx);
Parameter | Description |
---|---|
nctx |
The context to set. |
Sets the doctype object by parsing sysid.
public void setParsedDoctype( String rootname, String sysid, String pubid);
Parameter | Description |
---|---|
root |
The name of the root element. |
sysid |
The system id of the doctype. |
pubid |
The public id of the doctype (can be null),. |
Sets the standalone information stored in the <?xml ...?> tag.
public final void setStandalone( String value);
Parameter | Description |
---|---|
value |
The attribute value. |
Sets the version number stored in the <?xml ...?> tag.
public final void setVersion( String version);
Parameter | Description |
---|---|
version |
The version information to set. |
Validates the content of a element node. Returns TRUE
if valid, FALSE
otherwise.
public boolean validateElementContent( org.w3c.dom.Element elem);
Parameter | Description |
---|---|
elem |
Element to be validated. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the serialized/compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the serialized/ compressed stream. |
This class implements the DOM DocumentFragment interface. Extends XMLElement rather than XMLNode so it can be handled as an element. See also DocumentFragment, NodeFactory, DOMParser.setNodeFactory().
public class XMLDocumentFragment implements java.io.Serializable oracle.xml.parser.v2.XMLDocumentFragment
java.io.Serializable
Method | Description |
---|---|
Returns the attributes of the XMLDocumentFragment. |
|
Returns a code representing the type of the underlying object. |
|
Returns the parent of this node. |
Returns the attributes of the XMLDocumentFragment - an empty NamedNodeMap.
public org.w3c.dom.NamedNodeMap getAttributes();
Returns a code representing the type of the underlying object.
public short getNodeType();
Returns the parent of this node.
public org.w3c.dom.Node getParentNode();
This class is used to throw DOM exceptions.
public class XMLDOMException oracle.xml.parser.v2.XMLDOMException
Constructs an XMLDOMException
exception. The options are described in the following table.
Syntax | Description |
---|---|
short code); |
Constructs an |
String mess); |
Constructs an X |
Parameter | Description |
---|---|
code |
Code indicated in DOM interface, uses default message |
mess |
Message used in constructing the XMLDOMException |
This class implements the DOMImplementation
public class XMLDOMImplementation implements java.io.Serializable oracle.xml.parser.v2.XMLDOMImplementation
java.io.Serializable
Creates a new instance of XMLDOMImplementation.
public XMLDOMImplementation();
Creates an XMLDocument object containing the specified DocumentType Node and a root element with the specified names and the empty DocumentType node. Throws DOMException:
public org.w3c.dom.Document createDocument( String namespaceURI, String qualifiedName, org.w3c.dom.DocumentType doctype);
Creates an empty DocumentType node with root element name and system/public identifier. Returns the DocumentType object created. Throws DOMException:
public org.w3c.dom.DocumentType createDocumentType( String qualifiedName, String publicId, String systemId);
Parameter | Description |
---|---|
qualifiedName |
Qualified name of the root element. |
systemid |
System identifier of the DocumentType node. |
publicid |
Public identifier of the DocumentType node. |
Tests if the DOM implementation implements a specific feature. Returns TRUE if the feature is implemented, FALSE otherwise.
public boolean hasFeature( String feature, String version);
Parameter | Description |
---|---|
feature |
The feature being tested. |
version |
The version of the feature being tested. |
Sets a specified feature. Throws a DOMException
if the feature could not be set.
public void setFeature( String feature);
Parameter | Description |
---|---|
feature |
The DOM feature. |
This class implements the DOM Element
Interface.
public class XMLElement implementsoracle.xml.parser.v2.NSName
,oracle.xml.parser.v2.NSResolver
, java.io.Externalizable oracle.xml.parser.v2.XMLElement
java.io.Externalizable,NSName
, oracle.xml.util.NSName,NSResolver
, java.io.Serializable
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. For all normal XMLElement creation use createElement()
of XMLDocument.
public XMLElement();
Returns a duplicate of this node; serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode
returns null
.). Cloning an Element
copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text
node. Cloning any other type of node simply returns a copy of this node.
public org.w3c.dom.Node cloneNode(boolean deep);
Parameter | Description |
---|---|
true |
If |
Returns an attribute value by name; if that attribute does not have a specified or default value, returns an empty string.
public String getAttribute( String name);
Parameter | Description |
---|---|
name |
The name of the attribute to retrieve. |
Returns an Attr
node by name, or NULL
if there is no such attribute.
public org.w3c.dom.Attr getAttributeNode( String name);
Parameter | Description |
---|---|
name |
The name of the attribute node to retrieve. |
Returns attribute with the given namespaceURI and localName if it exists; otherwise, returns NULL.
public org.w3c.dom.Attr getAttributeNodeNS( String namespaceURI, String localName);
Parameter | Description |
---|---|
namespaceURI |
Namespace of the attribute node requested. |
localName |
Local name of the attribute node requested. |
Returns the value of the attribute with namespace URI and localName, if it exists; threshed, returns NULL
.
public String getAttributeNS( String namespaceURI, String localName);
Parameter | Description |
---|---|
namespaceURI |
Namespace of the attribute requested. |
localName |
Local name of the attribute requested. |
Returns a NamedNodeMap
containing the attributes of this node (if it is an Element
) or null
otherwise.
public org.w3c.dom.NamedNodeMap getAttributes();
Returns a NodeList
of all immediate children with a given tag name. The options are described in the following table.
Syntax | Description |
---|---|
String name); |
Returns a |
String ns); |
Returns a |
Parameter | Description |
---|---|
name |
The name of the tag to match on (should be local name). |
ns |
The name space. |
Returns a NodeList
of all the Element
s with a given tag name in the order in which they would be encountered in a preorder traversal of the Document
tree.
public org.w3c.dom.NodeList getElementsByTagName( String tagname);
Parameter | Description |
---|---|
tagname |
The name of the tag to match on. The special value "*" matches all tags. |
Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree.
public org.w3c.dom.NodeList getElementsByTagNameNS( String namespaceURI, String localName);
Parameter | Description |
---|---|
namespaceURI |
The namespace of the element. |
localName |
The local name of the element. |
Returns the fully resolved name for this element.
public String getExpandedName();
Retrieves the first Attr
node, or NULL
if there is no attribute.
public XMLNode
getFirstAttribute();
Returns the local Name for this element.
public String getLocalName();
Returns the name space URI of this element.
public String getNamespaceURI();
Returns a code representing the type of the underlying object.
public short getNodeType();
Returns the namespace prefix for this element.
public String getPrefix();
Returns the qualified name for this element.
public String getQualifiedName();
Returns the name of the element. 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.
public String getTagName();
Returns TRUE
when an attribute with a given name is specified on this element or has a default value, FALSE
otherwise.
public boolean hasAttribute( String name);
Parameter | Description |
---|---|
name |
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; returns FALSE
otherwise.
public boolean hasAttributeNS( String namespaceURI, String localName);
Parameter | Description |
---|---|
namespaceURI |
Namespace of the attribute whose presence is checked. |
localName |
Local name of the attribute whose presence is checked. |
Returns TRUE
if this node has any attributes, FALSE
otherwise.
public boolean hasAttributes();
Restores the information written by writeExternal by reading the input stream and regenerating the objects according to the information of the input stream. Throws the following exceptions:
IOException
when there is an exception reading the compressed stream.ClassNotFoundException
when the class is not foundpublic void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
ObjectInput stream used to read the compressed stream. |
Removes an attribute by name. If the removed attribute has a default value it is immediately replaced. Throws DOMException
:
public void removeAttribute( String name);
Parameter | Description |
---|---|
name |
Name of the attribute to remove. |
Removes and returns the specified attribute. Throws DOMException
:
oldAttr
is not an attribute of the element.public org.w3c.dom.Attr removeAttributeNode( org.w3c.dom.Attr oldAttr);
Parameter | Description |
---|---|
oldAttr |
The Attr node to remove from the attribute list. If the removed Attr has a default value it is immediately replaced. |
Removes an attribute by local name and namespace URI. Throws DOMEXception:
public void removeAttributeNS( String namespaceURI, String localName);
Parameter | Description |
---|---|
namespaceURI |
Namespace of the attribute to be removed. |
localName |
Local name of the attribute to be removed. |
Report SAX Events from a DOM Tree. Throws SAXException
.
public void reportSAXEvents( org.xml.sax.ContentHandler cntHandler);
Parameter | Description |
---|---|
cntHandler |
The Content Handler. |
Finds the namespace definition in scope in this element, given a namespace prefix.
public String resolveNamespacePrefix( String prefix);
Parameter | Description |
---|---|
prefix |
Namespace prefix to be resolved if the prefix; if default, returns the default namespace |
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. 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 through this method. Throws DOMException
:
public void setAttribute( String name, String value);
Parameter | Description |
---|---|
name |
The name of the attribute to create or alter. |
value |
Value to set in string form. |
Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one. 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
:
newAttr
was created from a different document than the one that created the element.newAttr
is already an attribute of another Element
object. The DOM user must explicitly clone Attr
nodes to reuse them in other elements.public org.w3c.dom.Attr setAttributeNode ( org.w3c.dom.Attr newAttr);
Parameter | Description |
---|---|
newAttr |
Attribute to be added to the attribute list. |
Adds a new attribute. Throws DOMException:
The options are described in the following table.
Validates the content of a element node. Returns TRUE if valid, FALSE otherwise. The options are described in the following table.
Parameter | Description |
---|---|
dtd |
The DTD object used to validate the element. |
schema |
The XMLSchema object used to validate the element. |
mode |
The validation mode. |
Saves the state of the object by creating a binary compressed stream with information about this object.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the serialized/compressed |
This class implements the DOM Entity
interface and represents an XML internal or external entity as defined in the XML Document Type Definition (DTD).
public class XMLEntity implements java.io.Externalizable oracle.xml.parser.v2.XMLEntity
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public XMLEntity();
Returns a duplicate of this node; serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode
returns null
.). Cloning an Element
copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text
node. Cloning any other type of node simply returns a copy of this node.
public org.w3c.dom.Node cloneNode(boolean deep);
Parameter | Description |
---|---|
deep |
If |
Returns a code representing the type of the underlying object.
public short getNodeType();
Returns the value of this node, depending on its type. Throws DOMException:
DOMString
variable on the implementation platform.public String getNodeValue();
Returns the name of the notation for an unparsed the entity. For parsed entities, this is null
.
public String getNotationName();
Returns the public identifier associated with the entity, if specified. If the public identifier was not specified, this is null
.
public String getPublicId();
Returns the system identifier associated with the entity, if specified. If the system identifier was not specified, this is null
.
public String getSystemId();
Reads the information written in the compressed stream by writeExternal() method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not found.public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Sets the value of entity.
public void setNodeValue( String arg);
Parameter | Description |
---|---|
arg |
The new value of the entity. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the serialized/ compressed stream. |
This class implements DOM EntityReference
interface.
public class XMLEntityReference implements java.lang.Cloneable, java.io.Externalizable oracle.xml.parser.v2.XMLEntityReference
java.lang.Cloneable, java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public XMLEntityReference();
Returns a code representing the type of the underlying object.
public short getNodeType();
Reads the information written in the compressed stream by writeExternal() method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not found.public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the compressed stream. |
Implements the DOM Node
interface and serves as the primary datatype for the entire Document Object Model. It represents a single node in the document tree.
The attributes nodeName, nodeValue and attributes are included as a mechanism to get at node information without casting down to the specific derived instance. In cases where there is no obvious mapping of these attributes for a specific nodeType (for example, nodeValue for an Element or attributes for a Comment), this returns null. Note that the derived classes may contain additional and more convenient mechanisms to get and set the relevant information. This DOM Nodes extending XMLNode instead of XMLNSNode have fixed Nodename defined by DOM specification. Also only node that cannot have child nodes extend this class.
public abstract class XMLNode implements java.lang.Cloneable, java.io.Externalizable oracle.xml.parser.v2.XMLNode
XMLNSNode
java.lang.Cloneable, java.io.Externalizable, java.io.Serializable
Constructs a new XMLNode
.
protected XMLNode();
Parameter | Description |
---|---|
tag |
Name of the node. |
Registers event listeners on the event target (node).
public void addEventListener( String type, org.w3c.dom.events.EventListener listener, boolean useCapture);
Parameter | Description |
---|---|
type |
Type of event for which the listener is registered. |
listener |
The listener object. |
useCapture |
Fag to indicate if the listener wants to initiate capture. |
Adds the node newChild
to the end of the list of children of this node, and returns the new node. If the newChild
is already in the tree, it is first removed. Throws DOMException:
newChild
node, or if the node to append is one of this node's ancestors.newChild
was created from a different document than the one that created this node.public org.w3c.dom.Node appendChild( org.w3c.dom.Node newChild);
Parameter | Description |
---|---|
newChild |
The node to add. If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node. |
Returns a duplicate of this node; serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode
returns null
.). Cloning an Element
copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text
node. Cloning any other type of node simply returns a copy of this node.
public org.w3c.dom.Node cloneNode( boolean deep);
Parameter | Description |
---|---|
deep |
If |
Dispatches the events into the implementations event model. Throws an exception of value UNSPECIFIED_EVENT_TYPE
if the Event's type was not specified by initializing the event before dispatchEvent was called.
public boolean dispatchEvent(org.w3c.dom.events.Event evt);
Parameter | Description |
---|---|
evt |
Indicates whether |
Returns a NamedNodeMap
containing the attributes of this node (if it is an Element
) or null
otherwise.
public org.w3c.dom.NamedNodeMap getAttributes();
Returns all children of this node in a NodeList
. If there are no children, this is a NodeList
containing no nodes. The content of the returned NodeList
is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList
accessors; it is not a static snapshot of the content of the node. This is true for every NodeList
, including the ones returned by the getElementsByTagName
method.
public org.w3c.dom.NodeList getChildNodes();
Returns the column number debug information.
public int getColumnNumber();
Returns the debug information mode.
public boolean getDebugMode();
Returns the first child of this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getFirstChild();
Returns the last child of this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getLastChild();
Returns the line number debug information.
public int getLineNumber();
Returns the Local Name of this node overrided by node types for which namespace is meaningful.
public String getLocalName();
Returns the namespace URI of this node, overrided by node types for which namespace is meaningful.
public String getNamespaceURI();
Returns the node immediately following this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getNextSibling();
Returns the name of the node.
public String getNodeName();
Returns the type of the node.
public short getNodeType();
Returns the value of this node, depending on its type. Throws DOMException
:
DOMString
variable on the implementation platform.public String getNodeValue();
Returns the Document
object associated with this node. This is also the Document
object used to create new nodes. When this node is a Document
this is null
.
public org.w3c.dom.Document getOwnerDocument();
Returns the parent of this node. All nodes, except Document
, DocumentFragment
, and Attr
may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null
.
public org.w3c.dom.Node getParentNode();
Returns the prefix of this node overrided by node types for which namespace is meaningful.
public String getPrefix();
Returns the node immediately preceding this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getPreviousSibling();
Returns the value of a property of the node.
public Object getProperty( String propName);
Parameter | Description |
---|---|
propName |
Name of the property. |
Returns the system id of the entity containing this node.
public String getSystemId();
Returns the non-marked-up text contained by this element. For text elements, this is the raw data. For elements with child nodes, this method traverses the entire subtree and appends the text for each terminal text element, effectively stripping out the XML markup for the subtree.
public String getText();
Determines whether this node (if it is an element) has any attributes. Returns TRUE
if this node has any attributes, FALSE
otherwise.
public boolean hasAttributes();
Determines whether a node has any children. Returns TRUE
if the node has any children, FALSE
if the node has no children.
public boolean hasChildNodes();
Inserts the node newChild
before the existing child node refChild
, and returns this node. 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. Throws DOMException
:
newChild
node, or if the node to insert is one of this node's ancestors.newChild
was created from a different document than the one that created this node.refChild
is not a child of this node.public org.w3c.dom.Node insertBefore( org.w3c.dom.Node newChild, org.w3c.dom.Node refChild);
Parameter | Description |
---|---|
newChild |
The node to insert. |
refChild |
The reference node, the node before which the new node must be inserted. |
Returns TRUE
if the node flag information is set.
public boolean isNodeFlag( int flag);
Parameter | Description |
---|---|
flag |
The flag. |
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node. Returns TRUE
if the feature is supported, FALSE
otherwise.
public boolean isSupported( String feature, String version);
Parameter | Description |
---|---|
feature |
The feature being tested. |
version |
The version of the feature being tested. |
Writes the contents of this node into output. Throws IOException
. The options are described in the following table.
Parameter | Description |
---|---|
out |
The output. |
enc |
Encoding to use for the output. |
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not found/public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Removes the child node indicated by oldChild
from the list of children, and returns it. Throws DOMException
:
oldChild
is not a child of this node.public org.w3c.dom.Node removeChild( org.w3c.dom.Node oldChild);
Parameter | Description |
---|---|
oldChild |
The node being removed. |
Removes event listeners from the event target (node).
public void removeEventListener( String type, org.w3c.dom.events.EventListener listener, boolean useCapture);
Parameter | Description |
---|---|
type |
Type of event for which the listener is registered. |
listener |
The listener object. |
useCapture |
The flag to indicate if the listener wants to initiate capture. |
Replaces the child node oldChild
with newChild
in the list of children, and returns the replaced node. If the newChild
is already in the tree, it is first removed. Throws DOMException:
newChild
node, or it the node to put in is one of this node's ancestors.newChild
was created from a different document than the one that created this node.oldChild
is not a child of this node.public org.w3c.dom.Node replaceChild( org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild);
Parameter | Description |
---|---|
newChild |
The new node to put in the child list. |
oldChild |
The node being replaced in the list. |
Report SAX Events from a DOM Tree. Throws SAXException
.
public void reportSAXEvents( org.xml.sax.ContentHandler cntHandler);
Parameter | Description |
---|---|
cntHandler |
The content handler. |
Resets the node flag information.
public void resetNodeFlag( int flag);
Parameter | Description |
---|---|
flag |
The node flag. |
Returns nodes from the tree which match the given pattern, as a NodeList. This method assumes that the pattern does not contain namespace prefixes. Throws XSLException
if there is an error while doing the match. The options are described in the following table.
Parameter | Description |
---|---|
pattern |
XSL pattern to match. |
nsr |
NSResolver to resolve any prefixes that occur in given pattern. |
Returns the first node from the tree that matches the given pattern. Throws XSLException
if there is an error while doing the match. The options are described in the following table.
Parameter | Description |
---|---|
pattern |
XSL pattern to match. |
nsr |
NSResolver to resolve any prefixes that occur in given pattern. |
Sets debug information in the node.
public void setDebugInfo( int line, int col, String sysid);
Parameter | Description |
---|---|
line |
The line number. |
col |
The column number. |
sysid |
The system id. |
Sets the node flag information.
public void setNodeFlag( int flag);
Parameter | Description |
---|---|
flag |
The node flag. |
Sets the value of this node, depending on its type. Throws DOMException
:
DOMString
variable on the implementation platform.public void setNodeValue( String nodeValue);
Parameter | Description |
---|---|
nodeValue |
The node value to set. |
Sets the prefix of this node overrided by node types for which namespace is meaningful. Throws DOMException
.
public void setPrefix( String prefix);
Parameter | Description |
---|---|
prefix |
The prefix to set. |
Sets a property of the node.
public void setProperty( String propName, Object propValue);
Parameter | Description |
---|---|
propName |
Name of the property. |
propValue |
Value of the property. |
Transforms a node in the tree using the given stylesheet, and returns the resulting DocumentFragment. Throws XSLException
.
public org.w3c.dom.DocumentFragment transformNode( XSLStylesheet
xsl);
Parameter | Description |
---|---|
xsl |
|
Selects the value of the first node from tree that matches the pattern. The options are described in the following table. Throws XSLException
if there is an error while doing the match.
Syntax | Description |
---|---|
String pattern); |
Matches using the pattern. |
NSResolver nsr); |
Matches using the pattern and namespace resolver. |
Parameter | Description |
---|---|
pattern |
XSL pattern to match |
nsr |
NSResolver to resolve any prefixes that occur in given pattern |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the serialized/ compressed stream. |
This class implements the DOM Notation
interface and represents a notation declared in the Document Type Definition.
public class XMLNotation implements java.io.Externalizable oracle.xml.parser.v2.XMLNotation
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object. For all normal XMLElement creation use XMLNotation()
.
public XMLNotation();
Returns a duplicate of this node; serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode
returns null
). Cloning an Element
copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text
node. Cloning any other type of node simply returns a copy of this node.
public org.w3c.dom.Node cloneNode( boolean deep);
Parameter | Description |
---|---|
deep |
If |
Returns the name of the Notation
public String getNodeName();
Returns a code representing the type of the underlying object.
public short getNodeType();
Returns the Public identifier; if not specified, then null.
public String getPublicId();
Returns the System identifier; if not specified, then null.
public String getSystemId();
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not found.public void readExternal( java.io.ObjectInput inArg);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Sets the Public Identifier.
public void setPublicId( String pubid);
Parameter | Description |
---|---|
pubid |
Public Identifier to set. |
Sets the System Identifier.
public void setSystemId( String url);
Parameter | Description |
---|---|
url |
System identifier to set. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the serialized/ compressed stream. |
Extends XMLNode to add support for Namespace names and children
public class XMLNSNode extendsoracle.xml.parser.v2.XMLNode
oracle.xml.parser.v2.XMLNode
| +--oracle.xml.parser.v2.XMLNSNode
java.lang.Cloneable, java.io.Externalizable, java.io.Serializable
Constructs a new XMLNSNode
.
protected XMLNSNode( String tag);
Parameter | Description |
---|---|
tag |
Name of the node. |
Adds text to this node, or appends it to the last child if the last child is a text node. Throws XMLDOMException
if text can't be added to this node. The options are described in the following table.
Syntax | Description |
---|---|
int length); |
Adds text from a Char array. |
String str); |
Adds text from a String. |
Parameter | Description |
---|---|
ch |
Char array to add. |
start |
Start index in the char array. |
length |
Number of chars to be added. |
str |
Text to add. |
Adds the node newChild
to the end of the list of children of this node, and returns that node. If the newChild
is already in the tree, it is first removed. Throws DOMException
:
newChild
node, or if the node to append is one of this node's ancestors.newChild
was created from a different document than the one that created this node.public org.w3c.dom.Node appendChild( org.w3c.dom.Node newChild);
Parameter | Description |
---|---|
newChild |
The node to add. If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node. |
Returns all children of this node as a NodeList
. If there are no children, this is a NodeList
containing no nodes. The content of the returned NodeList
is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList
accessors; it is not a static snapshot of the content of the node. This is true for every NodeList
, including the ones returned by the getElementsByTagName
method.
public org.w3c.dom.NodeList getChildNodes();
Returns the first child of this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getFirstChild();
Returns the last child of this node. If there is no such node, this returns null
.
public org.w3c.dom.Node getLastChild();
Returns the Local Name of this node overrided by node types for which namespace is meaningful.
public String getLocalName();
Returns the namespace URI of this node. overrided by node types for which namespace is meaningful.
public String getNamespaceURI();
Returns the name of this node, depending on its type
public String getNodeName();
Returns the prefix of this node overrided by node types for which namespace is meaningful.
public String getPrefix();
Returns the non-marked-up text contained by this element. For text elements, this is the raw data. For elements with child nodes, this method traverses the entire subtree and appends the text for each terminal text element, effectively stripping out the XML markup for the subtree. For example, if the XML document contains "William Shakespeare", XMLDocument.getText
returns "William Shakespeare".
public String getText();
This is a convenience method to allow easy determination of whether a node has any children. Returns TRUE
if the node has any children, FALSE
otherwise.
public boolean hasChildNodes();
Inserts the node newChild
before the existing child node refChild
, and returns the node being inserted. 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. Throws DOMException
:
newChild
node, or if the node to insert is one of this node's ancestors.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.public org.w3c.dom.Node insertBefore( org.w3c.dom.Node newChild, org.w3c.dom.Node refChild);
Parameter | Description |
---|---|
newChild |
The new node to put in the child list. |
refChild |
The reference node, or the node before which the new node must be inserted. |
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into "normal" form where only structure (for example, elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes; there are neither adjacent Text nodes nor empty 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 document tree structure are to be used.
public void normalize();
Removes the child node indicated by oldChild
from the list of children, and returns it. Throws DOMException
:
oldChild
is not a child of this node.public org.w3c.dom.Node removeChild( org.w3c.dom.Node oldChild);
<table> <thead> <tr><th> Parameter</th> <th> Description</th> </tr> <tbody> <tr><td>
oldChild </td> <td>
The node being removed.</td> </tr> </table>
Replaces the child node oldChild
with newChild
in the list of children, and returns the oldChild
node. If the newChild
is already in the tree, it is first removed. Throws DOMException
:
newChild
node, or it the node to put in is one of this node's ancestors.newChild
was created from a different document than the one that created this node.oldChild
is not a child of this node.public org.w3c.dom.Node replaceChild( org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild);
Parameter | Description |
---|---|
newChild |
The new node to put in the child list. |
oldChild |
The node being replaced in the list. |
Sets the prefix of this node overrided by node types for which namespace is meaningful.
public void setPrefix( String prefix);
Parameter | Description |
---|---|
prefix |
The prefix of the node. |
This class writes output stream and can handle XML encoding.
public class XMLOutputStream extends java.lang.Object java.lang.Object | +--oracle.xml.parser.v2.XMLOutputStream
Builds an ASCII output. The options are described in the following table.
Syntax | Description |
---|---|
java.io.OutputStream out); |
Builds the output using OutputStream. |
java.io.PrintWriter out); |
Builds the output using PrintWriter. |
Parameter | Description |
---|---|
out |
The output. |
Sets indenting level for output.
public void addIndent( int offset);
Parameter | Description |
---|---|
offset |
The indenting level. |
Closes the output stream. Throws IOException
if there is any error.
public void close();
Flushes the output stream. Throws IOException
if there is any error.
public void flush();
Returns the current output style.
public int getOutputStyle();
Sets the output character encoding. Throws IOException
if error in setting the encoding type.
public void setEncoding( String encoding, boolean lendian, boolean byteOrderMark);
Parameter | Description |
---|---|
encoding |
The encoding of the stream. |
lendian |
The flag to indicate if the encoding is of type little endian. |
byteOrderMark |
The flag to indicate if byte order mark is set. |
Sets the Output the style.
public void setOutputStyle( int style);
Parameter | Description |
---|---|
s |
The output style |
Outputs character according to type of the output stream. Throws IOException
if there is any error in writing the character.
public void write( int c);
Parameter | Description |
---|---|
c |
The character written. |
Writes string to the output. Throws IOException
if there is any error in writing the string.
public void writeChars( String str);
Parameter | Description |
---|---|
str |
The string that is written to the output stream. |
Writes an indentation. Throws IOException
if there is any error in writing the string.
public void writeIndent();
Writes a new line. Throws IOException
if there is any error in writing the string.
public void writeNewLine();
Writes string with surrounding quotes. Throws IOException
if there is any error in writing the string.
public void writeQuotedString( String str);
Parameter | Description |
---|---|
str |
The string that is written to the output stream. |
This class implements the DOM Processing Instruction interface. See also ProcessingInstruction, NodeFactory, DOMParser.setNodeFactory()
.
public class XMLPI implements java.io.Externalizable oracle.xml.parser.v2.XMLPI
XMLDeclPI
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public XMLPI();
Adds text string to the node, and returns the updated node.
public XMLNode
addText( String str);
Parameter | Description |
---|---|
str |
The Text string to be added. |
Returns the name of the PI Node.
public String getNodeName();
Returns the type of node of the underlying object
public short getNodeType();
Returns the target of this PI. XML defines this as the first token following markup that begins the processing instruction.
public String getTarget();
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. Throws the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
when the class is not found.public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream. |
Reports SAX Events from a DOM Tree. Throws SAXException
.
public void reportSAXEvents( org.xml.sax.ContentHandler cntHandler);
Parameter | Description |
---|---|
cntHandler |
Content handler. |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws the IOException
when there is an exception while writing the compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
ObjectOutput stream used to write the compressed stream. |
The XMLPrintDriver
implements PrintDriver
interface.
public class XMLPrintDriver extends Object implements
oracle.xml.parser.v2.PrintDriver
java.lang.Object
|
+--oracle.xml.parser.v2.XMLPrintDriver
PrintDriver
Field | Syntax | Description |
---|---|---|
|
|
XMLOutputStream object |
Creates an instance of XMLPrintDriver. The options are described in the following table.
Syntax | Description |
---|---|
OutputStream os); |
Creates an instance of XMLPrintDriver from an OutputStream. |
PrintWriter pw); |
Creates an instance of XMLPrintDriver from a PrintWriter. |
Parameter | Description |
---|---|
os |
The OutputStream. |
pw |
The PrintWriter. |
Closes the output stream or print writer
public void close();
Flushes the output stream or print writer.
public void flush();
Prints an XMLAttr
node.
public void printAttribute( XMLAttr
attr);
Parameter | Description |
---|---|
attr |
The XMLAttr Node. |
Calls print method for each attribute of the XMLElement.
public final void printAttributeNodes( XMLElement
elem);
Parameter | Description |
---|---|
elem |
The elem whose attributes are to be printed |
Prints an XMLCDATA
node.
public void printCDATASection( XMLCDATA
cdata);
Parameter | Description |
---|---|
cdata |
The XMLCDATA node |
Calls print method for each child of the XMLNode.
public final void printChildNodes( XMLNode
node);
Parameter | Description |
---|---|
node |
The node whose children are to be printed. |
Prints an XMLComment
node.
public void printComment( XMLComment
comment);
Parameter | Description |
---|---|
comment |
The comment node. |
Prints an DTD
.
public void printDoctype( DTD
dtd);
Parameter | Description |
---|---|
dtd |
The DTD to be printed. |
Prints an XMLDocument
.
public void printDocument( XMLDocument
doc);
Parameter | Description |
---|---|
doc |
The document to be printed |
Prints an empty XMLDocumentFragment
object.
public void printDocumentFragment( XMLDocumentFragment
dfrag);
Parameter | Description |
---|---|
dfrag |
The document fragment to be printed. |
Prints an XMLElement
.
public void printElement( XMLElement
elem);
Parameter | Description |
---|---|
elem |
The element to be printed. |
Prints an XMLEntityReference
node
public void printEntityReference( XMLEntityReference
en);
Parameter | Description |
---|---|
en |
The XMLEntityReference node. |
Prints an XMLPI
node
public void printProcessingInstruction( XMLPI
pi);
Parameter | Description |
---|---|
pi |
The XMLPI node. |
Prints an XMLText
node.
public void printTextNode( XMLText
text);
Parameter | Description |
---|---|
text |
The text node. |
Sets the encoding of the print driver.
public void setEncoding( String enc);
Parameter | Description |
---|---|
enc |
The encoding of the document being printed. |
This class customizes the RangeException.
public class XMLRangeException oracle.xml.parser.v2.XMLRangeException
Generates an XM
LRangeException instance.
public XMLRangeException(short code);
Parameter | Description |
---|---|
code |
This class implements the DOM Text interface. See also Text, NodeFactory, DOMParser.setNodeFactory()
.
public class XMLText implements java.io.Serializable, java.io.Externalizable oracle.xml.parser.v2.XMLText
java.io.Externalizable, java.io.Serializable
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.
public XMLText();
Adds text to the data of the text node, similar to appendData.
public void addText( char[] ch, int start, int length);
Parameter | Description |
---|---|
ch |
char array to be appended |
start |
start index |
length |
length of the char array |
Returns the character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a Text
node. However, implementation limits may mean that the entirety of a node's data may not fit into a single DOMString
. In such cases, the user may call substringData
to retrieve the data in appropriately sized pieces.
Throws DOMException
:
DOMString
variable on the implementation platform.public String getData();
Returns the name of the XMLText Node.
public String getNodeName();
Returns a type of node representing the type of the underlying object.
public short getNodeType();
Returns String value of this text node. Throws DOMException
if any error occurs when retrieving the value.
public String getNodeValue();
Checks if the text node is a whitespace node.
public boolean isWhiteSpaceNode();
Reads the information written in the compressed stream by writeExternal method and restores the object correspondingly. This method is called if XMLText object is deserialized (or read) as an independent node and not called from some other DOM nodeThrows the following exceptions:
IOException
when there is an error in reading the input stream.ClassNotFoundException
-when the class is not found.public void readExternal( java.io.ObjectInput in);
Parameter | Description |
---|---|
in |
The ObjectInput stream used for reading the compressed stream |
Reports SAX Events from a DOM Tree. Throws SAXException
.
public void reportSAXEvents(org.xml.sax.ContentHandler cntHandler);
Parameter | Description |
---|---|
cntHandler |
Content handler. |
Breaks Text
node into two Text nodes at specified offset, so they are both siblings, and the node only contains content up to the offset. Returns the new Text node. New node inserted as next sibling contains all content at and after the offset point.
Throws DOMException:
data
.public org.w3c.dom.Text splitText( int offset);
Parameter | Description |
---|---|
offset |
Offset at which to split, starting from 0 |
Saves the state of the object by creating a binary compressed stream with information about this object. Throws IOException
when there is an exception while writing the compressed stream.
public void writeExternal( java.io.ObjectOutput out);
Parameter | Description |
---|---|
out |
The ObjectOutput stream used to write the compressed stream. |
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|