org.apache.axiom.om.impl.dom
Class DocumentImpl

java.lang.Object
  extended by org.apache.axiom.om.impl.dom.NodeImpl
      extended by org.apache.axiom.om.impl.dom.ChildNode
          extended by org.apache.axiom.om.impl.dom.ParentNode
              extended by org.apache.axiom.om.impl.dom.DocumentImpl
All Implemented Interfaces:
Cloneable, OMContainerEx, OMNodeEx, OMContainer, OMDocument, OMNode, OMSerializable, Document, Node, NodeList
Direct Known Subclasses:
SOAPMessageImpl

public class DocumentImpl
extends ParentNode
implements Document, OMDocument


Field Summary
protected  ElementImpl documentElement
           
protected  Hashtable identifiers
           
 
Fields inherited from class org.apache.axiom.om.impl.dom.ParentNode
firstChild, lastChild
 
Fields inherited from class org.apache.axiom.om.impl.dom.ChildNode
nextSibling, parentNode, previousSibling
 
Fields inherited from class org.apache.axiom.om.impl.dom.NodeImpl
builder, done, factory, FIRSTCHILD, flags, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.apache.axiom.om.OMDocument
XML_10, XML_11
 
Fields inherited from interface org.apache.axiom.om.OMNode
DTD_NODE, PI_NODE, SPACE_NODE
 
Constructor Summary
DocumentImpl(DocumentImpl ownerDocument, OMFactory factory)
           
DocumentImpl(OMFactory factory)
           
DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory)
           
 
Method Summary
protected  void addIdAttr(Attr attr)
           
 Node adoptNode(Node node)
           
protected  void checkQName(String prefix, String local)
          Borrowed from the Xerces impl.
 Attr createAttribute(String name)
           
 Attr createAttributeNS(String namespaceURI, String qualifiedName)
           
 CDATASection createCDATASection(String arg0)
           
 Comment createComment(String data)
           
 DocumentFragment createDocumentFragment()
           
 Element createElement(String tagName)
           
 Element createElementNS(String ns, String qualifiedName)
           
 EntityReference createEntityReference(String arg0)
           
 ProcessingInstruction createProcessingInstruction(String target, String data)
           
 Text createTextNode(String value)
           
 String getCharsetEncoding()
          Get the character set encoding scheme.
 DocumentType getDoctype()
           
 Element getDocumentElement()
          Returns the document element.
 String getDocumentURI()
           
 DOMConfiguration getDomConfig()
           
 Element getElementById(String elementId)
           
 NodeList getElementsByTagName(String arg0)
           
 NodeList getElementsByTagNameNS(String arg0, String arg1)
           
 DOMImplementation getImplementation()
           
 String getInputEncoding()
           
 OMNode getNextOMSibling()
          Default behavior returns null, overriden in ChildNode.
 Node getNextSibling()
          Returns the next child of this node's parent, or null if none.
 String getNodeName()
           
 short getNodeType()
           
 OMElement getOMDocumentElement()
          Returns the document element.
 OMContainer getParent()
          Returns the parent containing node.
 OMNode getPreviousOMSibling()
          Default behavior returns null, overriden in ChildNode.
 Node getPreviousSibling()
          Returns the previous child of this node's parent, or null if none.
 boolean getStrictErrorChecking()
           
 String getTextContent()
           
 int getType()
          Returns the type of node.
 String getXmlEncoding()
           
 String getXMLEncoding()
          Get the charset encoding of this document as specified in the XML declaration.
 boolean getXmlStandalone()
           
 String getXmlVersion()
           
 String getXMLVersion()
          Returns the XML version.
 Node importNode(Node importedNode, boolean deep)
           
 void internalSerialize(XMLStreamWriter writer, boolean cache)
          Serializes the node.
protected  void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration)
           
 String isStandalone()
          XML standalone value.
 void normalizeDocument()
           
protected  void removeIdAttr(Attr attr)
           
 Node renameNode(Node arg0, String arg1, String arg2)
           
 void serialize(OutputStream output, OMOutputFormat format)
          Serializes the node with caching.
 void serializeAndConsume(OutputStream output, OMOutputFormat format)
          Serializes the node without caching.
 void setCharsetEncoding(String charsetEncoding)
          Sets the character set encoding scheme to be used.
 void setDocumentURI(String arg0)
           
 void setNextOMSibling(OMNode node)
           
 void setOMDocumentElement(OMElement rootElement)
          Sets the document element of the XML document.
 void setParent(OMContainer element)
           
 void setPreviousOMSibling(OMNode node)
           
 void setStandalone(String isStandalone)
           
 void setStrictErrorChecking(boolean arg0)
           
 void setTextContent(String textContent)
           
 void setType(int nodeType)
           
 void setXMLEncoding(String encoding)
          Set the charset encoding for the XML declaration of this document.
 void setXmlStandalone(boolean standalone)
           
 void setXmlVersion(String version)
           
 void setXMLVersion(String version)
          Sets the XML version.
 
Methods inherited from class org.apache.axiom.om.impl.dom.ParentNode
addChild, buildNext, cloneNode, getBuilder, getChildNodes, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getFirstChild, getFirstChildWithName, getFirstOMChild, getFirstOMChildIfAvailable, getLastChild, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, hasChildNodes, importNode, insertBefore, removeChild, replaceChild, setFirstChild, setLastChild
 
Methods inherited from class org.apache.axiom.om.impl.dom.ChildNode
detach, discard, getNextOMSiblingIfAvailable, getParentNode, insertSiblingAfter, insertSiblingBefore
 
Methods inherited from class org.apache.axiom.om.impl.dom.NodeImpl
appendChild, build, buildWithAttachments, close, compareDocumentPosition, getAttributes, getBaseURI, getFeature, getLength, getLocalName, getNamespaceURI, getNodeValue, getOMFactory, getOwnerDocument, getPrefix, getUserData, hasAttributes, internalSerialize, internalSerializeAndConsume, isComplete, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNodeValue, setOwnerDocument, setPrefix, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setUserData
 
Methods inherited from interface org.apache.axiom.om.OMContainer
addChild, buildNext, getBuilder, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getFirstChildWithName, getFirstOMChild, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume
 
Methods inherited from interface org.apache.axiom.om.OMSerializable
build, close, getOMFactory, isComplete, serialize, serialize, serializeAndConsume
 
Methods inherited from interface org.apache.axiom.om.impl.OMContainerEx
setComplete
 

Field Detail

documentElement

protected ElementImpl documentElement

identifiers

protected Hashtable identifiers
Constructor Detail

DocumentImpl

public DocumentImpl(DocumentImpl ownerDocument,
                    OMFactory factory)
Parameters:
ownerDocument -

DocumentImpl

public DocumentImpl(OMXMLParserWrapper parserWrapper,
                    OMFactory factory)

DocumentImpl

public DocumentImpl(OMFactory factory)
Method Detail

setType

public void setType(int nodeType)
             throws OMException
Specified by:
setType in interface OMNodeEx
Throws:
OMException

getType

public int getType()
            throws OMException
Description copied from interface: OMNode
Returns the type of node.

Specified by:
getType in interface OMNode
Returns:
Returns one of OMNode.ELEMENT_NODE, OMNode.TEXT_NODE, OMNode.CDATA_SECTION_NODE, OMNode.COMMENT_NODE, OMNode.DTD_NODE, OMNode.PI_NODE, OMNode.ENTITY_REFERENCE_NODE or OMNode.SPACE_NODE.
Throws:
OMException

internalSerialize

public void internalSerialize(XMLStreamWriter writer,
                              boolean cache)
                       throws XMLStreamException
Description copied from interface: OMNodeEx
Serializes the node. Note that this is an internal method that MUST NOT be used outside of Axiom. Please use OMSerializable.serialize(XMLStreamWriter, boolean) instead.

Specified by:
internalSerialize in interface OMNodeEx
cache - indicates if caching should be enabled
Throws:
XMLStreamException

getNextOMSibling

public OMNode getNextOMSibling()
                        throws OMException
Description copied from class: NodeImpl
Default behavior returns null, overriden in ChildNode.

Specified by:
getNextOMSibling in interface OMNode
Overrides:
getNextOMSibling in class ChildNode
Returns:
Returns the next sibling in document order.
Throws:
OMException

getNextSibling

public Node getNextSibling()
Description copied from class: NodeImpl
Returns the next child of this node's parent, or null if none.

Specified by:
getNextSibling in interface Node
Overrides:
getNextSibling in class ChildNode

getParent

public OMContainer getParent()
                      throws OMException
Description copied from interface: OMNode
Returns the parent containing node.

Returns the parent container, which may be either an OMDocument or OMElement.

Specified by:
getParent in interface OMNode
Overrides:
getParent in class ChildNode
Returns:
The OMContainer of the node.
Throws:
OMException

getPreviousOMSibling

public OMNode getPreviousOMSibling()
Description copied from class: NodeImpl
Default behavior returns null, overriden in ChildNode.

Specified by:
getPreviousOMSibling in interface OMNode
Overrides:
getPreviousOMSibling in class ChildNode
Returns:
Returns node.

getPreviousSibling

public Node getPreviousSibling()
Description copied from class: NodeImpl
Returns the previous child of this node's parent, or null if none.

Specified by:
getPreviousSibling in interface Node
Overrides:
getPreviousSibling in class ChildNode

setNextOMSibling

public void setNextOMSibling(OMNode node)
Specified by:
setNextOMSibling in interface OMNodeEx
Overrides:
setNextOMSibling in class ChildNode

setParent

public void setParent(OMContainer element)
Specified by:
setParent in interface OMNodeEx
Overrides:
setParent in class ChildNode

setPreviousOMSibling

public void setPreviousOMSibling(OMNode node)
Specified by:
setPreviousOMSibling in interface OMNodeEx
Overrides:
setPreviousOMSibling in class ChildNode

getNodeName

public String getNodeName()
Specified by:
getNodeName in interface Node

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface Node

createAttribute

public Attr createAttribute(String name)
                     throws DOMException
Specified by:
createAttribute in interface Document
Throws:
DOMException

createAttributeNS

public Attr createAttributeNS(String namespaceURI,
                              String qualifiedName)
                       throws DOMException
Specified by:
createAttributeNS in interface Document
Throws:
DOMException

createCDATASection

public CDATASection createCDATASection(String arg0)
                                throws DOMException
Specified by:
createCDATASection in interface Document
Throws:
DOMException

createComment

public Comment createComment(String data)
Specified by:
createComment in interface Document

createDocumentFragment

public DocumentFragment createDocumentFragment()
Specified by:
createDocumentFragment in interface Document

createElement

public Element createElement(String tagName)
                      throws DOMException
Specified by:
createElement in interface Document
Throws:
DOMException

createElementNS

public Element createElementNS(String ns,
                               String qualifiedName)
                        throws DOMException
Specified by:
createElementNS in interface Document
Throws:
DOMException

createEntityReference

public EntityReference createEntityReference(String arg0)
                                      throws DOMException
Specified by:
createEntityReference in interface Document
Throws:
DOMException

createProcessingInstruction

public ProcessingInstruction createProcessingInstruction(String target,
                                                         String data)
                                                  throws DOMException
Specified by:
createProcessingInstruction in interface Document
Throws:
DOMException

createTextNode

public Text createTextNode(String value)
Specified by:
createTextNode in interface Document

getDoctype

public DocumentType getDoctype()
Specified by:
getDoctype in interface Document

getElementById

public Element getElementById(String elementId)
Specified by:
getElementById in interface Document

getElementsByTagName

public NodeList getElementsByTagName(String arg0)
Specified by:
getElementsByTagName in interface Document

getElementsByTagNameNS

public NodeList getElementsByTagNameNS(String arg0,
                                       String arg1)
Specified by:
getElementsByTagNameNS in interface Document

getImplementation

public DOMImplementation getImplementation()
Specified by:
getImplementation in interface Document

importNode

public Node importNode(Node importedNode,
                       boolean deep)
                throws DOMException
Specified by:
importNode in interface Document
Throws:
DOMException

getCharsetEncoding

public String getCharsetEncoding()
Description copied from interface: OMDocument
Get the character set encoding scheme. This is the encoding that was used used for this document at the time of the parsing. This is null when it is not known, such as when the document was created in memory or from a character stream.

Specified by:
getCharsetEncoding in interface OMDocument
Returns:
the charset encoding for this document, or null if the encoding is not known

getXMLVersion

public String getXMLVersion()
Description copied from interface: OMDocument
Returns the XML version.

Specified by:
getXMLVersion in interface OMDocument
Returns:
Returns String.

isStandalone

public String isStandalone()
Description copied from interface: OMDocument
XML standalone value. This will be yes, no or null (if not available)

Specified by:
isStandalone in interface OMDocument
Returns:
Returns boolean.

setCharsetEncoding

public void setCharsetEncoding(String charsetEncoding)
Description copied from interface: OMDocument
Sets the character set encoding scheme to be used.

Specified by:
setCharsetEncoding in interface OMDocument

setOMDocumentElement

public void setOMDocumentElement(OMElement rootElement)
Description copied from interface: OMDocument
Sets the document element of the XML document.

Specified by:
setOMDocumentElement in interface OMDocument

setStandalone

public void setStandalone(String isStandalone)
Specified by:
setStandalone in interface OMDocument

serializeAndConsume

public void serializeAndConsume(OutputStream output,
                                OMOutputFormat format)
                         throws XMLStreamException
Description copied from interface: OMContainer
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMContainer
Specified by:
serializeAndConsume in interface OMNode
Overrides:
serializeAndConsume in class NodeImpl
Throws:
XMLStreamException

serialize

public void serialize(OutputStream output,
                      OMOutputFormat format)
               throws XMLStreamException
Description copied from interface: OMContainer
Serializes the node with caching.

Specified by:
serialize in interface OMContainer
Specified by:
serialize in interface OMNode
Overrides:
serialize in class NodeImpl
Throws:
XMLStreamException

setXMLVersion

public void setXMLVersion(String version)
Description copied from interface: OMDocument
Sets the XML version.

Specified by:
setXMLVersion in interface OMDocument
See Also:
XML 1.0, XML 1.1

getXMLEncoding

public String getXMLEncoding()
Description copied from interface: OMDocument
Get the charset encoding of this document as specified in the XML declaration.

Specified by:
getXMLEncoding in interface OMDocument
Returns:
the charset encoding specified in the XML declaration, or null if the document didn't have an XML declaration or if the encoding attribute was not specified in the XML declaration

setXMLEncoding

public void setXMLEncoding(String encoding)
Description copied from interface: OMDocument
Set the charset encoding for the XML declaration of this document.

Specified by:
setXMLEncoding in interface OMDocument
Parameters:
encoding - the value of the encoding attribute of the XML declaration

getOMDocumentElement

public OMElement getOMDocumentElement()
Returns the document element.

Specified by:
getOMDocumentElement in interface OMDocument
Returns:
Returns OMElement.
See Also:
OMDocument.getOMDocumentElement()

getDocumentElement

public Element getDocumentElement()
Returns the document element.

Specified by:
getDocumentElement in interface Document
See Also:
Document.getDocumentElement()

checkQName

protected final void checkQName(String prefix,
                                String local)
Borrowed from the Xerces impl. Checks if the given qualified name is legal with respect to the version of XML to which this document must conform.

Parameters:
prefix - prefix of qualified name
local - local part of qualified name

addIdAttr

protected void addIdAttr(Attr attr)

removeIdAttr

protected void removeIdAttr(Attr attr)

getTextContent

public String getTextContent()
                      throws DOMException
Specified by:
getTextContent in interface Node
Overrides:
getTextContent in class ParentNode
Throws:
DOMException

setTextContent

public void setTextContent(String textContent)
                    throws DOMException
Specified by:
setTextContent in interface Node
Overrides:
setTextContent in class ParentNode
Throws:
DOMException

adoptNode

public Node adoptNode(Node node)
               throws DOMException
Specified by:
adoptNode in interface Document
Throws:
DOMException

getDocumentURI

public String getDocumentURI()
Specified by:
getDocumentURI in interface Document

getDomConfig

public DOMConfiguration getDomConfig()
Specified by:
getDomConfig in interface Document

getInputEncoding

public String getInputEncoding()
Specified by:
getInputEncoding in interface Document

getStrictErrorChecking

public boolean getStrictErrorChecking()
Specified by:
getStrictErrorChecking in interface Document

getXmlEncoding

public String getXmlEncoding()
Specified by:
getXmlEncoding in interface Document

getXmlStandalone

public boolean getXmlStandalone()
Specified by:
getXmlStandalone in interface Document

getXmlVersion

public String getXmlVersion()
Specified by:
getXmlVersion in interface Document

normalizeDocument

public void normalizeDocument()
Specified by:
normalizeDocument in interface Document

renameNode

public Node renameNode(Node arg0,
                       String arg1,
                       String arg2)
                throws DOMException
Specified by:
renameNode in interface Document
Throws:
DOMException

setDocumentURI

public void setDocumentURI(String arg0)
Specified by:
setDocumentURI in interface Document

setStrictErrorChecking

public void setStrictErrorChecking(boolean arg0)
Specified by:
setStrictErrorChecking in interface Document

setXmlStandalone

public void setXmlStandalone(boolean standalone)
                      throws DOMException
Specified by:
setXmlStandalone in interface Document
Throws:
DOMException

setXmlVersion

public void setXmlVersion(String version)
                   throws DOMException
Specified by:
setXmlVersion in interface Document
Throws:
DOMException

internalSerialize

protected void internalSerialize(XMLStreamWriter writer,
                                 boolean cache,
                                 boolean includeXMLDeclaration)
                          throws XMLStreamException
Throws:
XMLStreamException


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.