org.apache.axiom.om.impl.llom
Class OMDocumentImpl

java.lang.Object
  extended by org.apache.axiom.om.impl.llom.OMDocumentImpl
All Implemented Interfaces:
OMContainerEx, OMContainer, OMDocument
Direct Known Subclasses:
SOAPMessageImpl

public class OMDocumentImpl
extends Object
implements OMDocument, OMContainerEx

Class OMDocumentImpl


Field Summary
protected  String charSetEncoding
          Field charSetEncoding Default : UTF-8
protected  OMElement documentElement
          Field documentElement
protected  boolean done
          Field done
protected  OMFactory factory
           
protected  OMNode firstChild
          Field firstChild
protected  String isStandalone
           
protected  OMNode lastChild
          Field lastChild
protected  OMXMLParserWrapper parserWrapper
          Field parserWrapper
protected  String xmlVersion
          Field xmlVersion
 
Fields inherited from interface org.apache.axiom.om.OMDocument
XML_10, XML_11
 
Constructor Summary
OMDocumentImpl()
          Default constructor
OMDocumentImpl(OMElement documentElement, OMXMLParserWrapper parserWrapper)
           
OMDocumentImpl(OMElement documentElement, OMXMLParserWrapper parserWrapper, OMFactory factory)
          Create the OMDoucment with the factory and set the given OMElement as the document element
OMDocumentImpl(OMFactory factory)
          Create a OMDocument given the OMFactory
OMDocumentImpl(OMXMLParserWrapper parserWrapper)
           
OMDocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory)
          Create the OMDocument with the factory
 
Method Summary
 void addChild(OMNode child)
          Adds child to the element.
 void buildNext()
          Forces the parser to proceed, if parser has not yet finished with the XML input.
 String getCharsetEncoding()
          Returns the character set encoding scheme to be used.
 Iterator getChildren()
          Returns a collection of this element.
 Iterator getChildrenWithLocalName(String localName)
          Returns an iterator for child nodes matching the local name.
 Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
          Searches for children with a given QName and returns an iterator to traverse through the OMNodes.
 Iterator getChildrenWithNamespaceURI(String uri)
          Returns an iterator for child nodes matching the namespace uri.
 OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName)
          Method getFirstChildWithName.
 OMNode getFirstOMChild()
          Method getFirstOMChild.
 OMElement getOMDocumentElement()
          Method getDocumentElement.
 OMFactory getOMFactory()
          Returns the OMFactory that created this object
 String getXMLVersion()
          Returns the XML version.
 void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
          Serializes the document with cache.
 void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean includeXMLDeclaration)
          Serializes the document with cache.
protected  void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration)
           
 void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
          Serializes the document with the XML declaration.
 void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer, boolean includeXMLDeclaration)
          Serialize the docuement with/without the XML declaration
 boolean isComplete()
          Indicates whether parser has parsed this information item completely or not.
 String isStandalone()
          XML standalone value.
 void serialize(OutputStream output)
          Serializes the document directly to the output stream with caching enabled.
 void serialize(OutputStream output, OMOutputFormat format)
          Serializes the document directly to the output stream with caching enabled.
 void serializeAndConsume(OutputStream output)
          Serializes the document directly to the output stream with caching disabled.
 void serializeAndConsume(OutputStream output, OMOutputFormat format)
          Serializes the document directly to the output stream with caching disabled.
 void setCharsetEncoding(String charEncoding)
          Sets the character set encoding scheme.
 void setComplete(boolean state)
          Method setComplete.
 void setFirstChild(OMNode firstChild)
          Method setFirstChild.
 void setLastChild(OMNode omNode)
          Forcefully set the last child
 void setOMDocumentElement(OMElement documentElement)
          Method setDocumentElement.
 void setStandalone(String isStandalone)
           
 void setXMLVersion(String xmlVersion)
          Sets the XML version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

documentElement

protected OMElement documentElement
Field documentElement


firstChild

protected OMNode firstChild
Field firstChild


lastChild

protected OMNode lastChild
Field lastChild


done

protected boolean done
Field done


parserWrapper

protected OMXMLParserWrapper parserWrapper
Field parserWrapper


charSetEncoding

protected String charSetEncoding
Field charSetEncoding Default : UTF-8


xmlVersion

protected String xmlVersion
Field xmlVersion


isStandalone

protected String isStandalone

factory

protected OMFactory factory
Constructor Detail

OMDocumentImpl

public OMDocumentImpl()
Default constructor


OMDocumentImpl

public OMDocumentImpl(OMElement documentElement,
                      OMXMLParserWrapper parserWrapper)
Parameters:
documentElement -
parserWrapper -

OMDocumentImpl

public OMDocumentImpl(OMXMLParserWrapper parserWrapper)
Parameters:
parserWrapper -

OMDocumentImpl

public OMDocumentImpl(OMFactory factory)
Create a OMDocument given the OMFactory

Parameters:
factory - The OMFactory that created this instace

OMDocumentImpl

public OMDocumentImpl(OMXMLParserWrapper parserWrapper,
                      OMFactory factory)
Create the OMDocument with the factory

Parameters:
parserWrapper -
factory -

OMDocumentImpl

public OMDocumentImpl(OMElement documentElement,
                      OMXMLParserWrapper parserWrapper,
                      OMFactory factory)
Create the OMDoucment with the factory and set the given OMElement as the document element

Parameters:
documentElement -
parserWrapper -
factory -
Method Detail

getOMDocumentElement

public OMElement getOMDocumentElement()
Method getDocumentElement.

Specified by:
getOMDocumentElement in interface OMDocument
Returns:
Returns OMElement.

setOMDocumentElement

public void setOMDocumentElement(OMElement documentElement)
Method setDocumentElement.

Specified by:
setOMDocumentElement in interface OMDocument
Parameters:
documentElement -

isComplete

public boolean isComplete()
Indicates whether parser has parsed this information item completely or not. If some information is not available in the item, one has to check this attribute to make sure that, this item has been parsed completely or not.

Specified by:
isComplete in interface OMContainer
Returns:
Returns boolean.

setComplete

public void setComplete(boolean state)
Method setComplete.

Specified by:
setComplete in interface OMContainerEx
Parameters:
state -

buildNext

public void buildNext()
Forces the parser to proceed, if parser has not yet finished with the XML input.

Specified by:
buildNext in interface OMContainer

addChild

public void addChild(OMNode child)
Adds child to the element. One can decide whether to append the child or to add to the front of the children list.

Specified by:
addChild in interface OMContainer
Parameters:
child -

getChildren

public Iterator getChildren()
Returns a collection of this element. Children can be of types OMElement, OMText.

Specified by:
getChildren in interface OMContainer
Returns:
Returns iterator.
See Also:
OMContainer.getFirstChildWithName(javax.xml.namespace.QName), OMContainer.getChildrenWithName(javax.xml.namespace.QName)

getChildrenWithName

public Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
Searches for children with a given QName and returns an iterator to traverse through the OMNodes. The QName can contain any combination of prefix, localname and URI.

Specified by:
getChildrenWithName in interface OMContainer
Parameters:
elementQName -
Returns:
Returns Iterator.
Throws:
OMException

getChildrenWithLocalName

public Iterator getChildrenWithLocalName(String localName)
Description copied from interface: OMContainer
Returns an iterator for child nodes matching the local name.

Specified by:
getChildrenWithLocalName in interface OMContainer
Returns:
Returns an iterator of OMElement items that match the given localName

getChildrenWithNamespaceURI

public Iterator getChildrenWithNamespaceURI(String uri)
Description copied from interface: OMContainer
Returns an iterator for child nodes matching the namespace uri.

Specified by:
getChildrenWithNamespaceURI in interface OMContainer
Returns:
Returns an iterator of OMElement items that match the given uri

getFirstOMChild

public OMNode getFirstOMChild()
Method getFirstOMChild.

Specified by:
getFirstOMChild in interface OMContainer
Returns:
Returns first om child.

getFirstChildWithName

public OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName)
                                throws OMException
Method getFirstChildWithName.

Specified by:
getFirstChildWithName in interface OMContainer
Parameters:
elementQName -
Returns:
Returns OMElement.
Throws:
OMException
See Also:
OMContainer.getChildrenWithName(javax.xml.namespace.QName)

setFirstChild

public void setFirstChild(OMNode firstChild)
Method setFirstChild.

Specified by:
setFirstChild in interface OMContainerEx
Parameters:
firstChild -

setLastChild

public void setLastChild(OMNode omNode)
Forcefully set the last child

Specified by:
setLastChild in interface OMContainerEx
Parameters:
omNode -

getCharsetEncoding

public String getCharsetEncoding()
Returns the character set encoding scheme to be used.

Specified by:
getCharsetEncoding in interface OMDocument
Returns:
Returns charset.

setCharsetEncoding

public void setCharsetEncoding(String charEncoding)
Sets the character set encoding scheme.

Specified by:
setCharsetEncoding in interface OMDocument
Parameters:
charEncoding -

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.

setStandalone

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

getXMLVersion

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

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

setXMLVersion

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

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

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer,
                                        boolean includeXMLDeclaration)
                                 throws javax.xml.stream.XMLStreamException
Serialize the docuement with/without the XML declaration

Throws:
javax.xml.stream.XMLStreamException

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
                                 throws javax.xml.stream.XMLStreamException
Serializes the document with the XML declaration.

Throws:
javax.xml.stream.XMLStreamException

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
                       throws javax.xml.stream.XMLStreamException
Serializes the document with cache.

Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(OutputStream output)
                         throws javax.xml.stream.XMLStreamException
Serializes the document directly to the output stream with caching disabled.

Specified by:
serializeAndConsume in interface OMDocument
Parameters:
output -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(OutputStream output)
               throws javax.xml.stream.XMLStreamException
Serializes the document directly to the output stream with caching enabled.

Specified by:
serialize in interface OMDocument
Parameters:
output -
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(OutputStream output,
                                OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Serializes the document directly to the output stream with caching disabled.

Specified by:
serializeAndConsume in interface OMDocument
Parameters:
output -
format -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(OutputStream output,
                      OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Serializes the document directly to the output stream with caching enabled.

Specified by:
serialize in interface OMDocument
Parameters:
output -
format -
Throws:
javax.xml.stream.XMLStreamException

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer,
                              boolean includeXMLDeclaration)
                       throws javax.xml.stream.XMLStreamException
Serializes the document with cache.

Throws:
javax.xml.stream.XMLStreamException

internalSerialize

protected void internalSerialize(javax.xml.stream.XMLStreamWriter writer,
                                 boolean cache,
                                 boolean includeXMLDeclaration)
                          throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getOMFactory

public OMFactory getOMFactory()
Description copied from interface: OMDocument
Returns the OMFactory that created this object

Specified by:
getOMFactory in interface OMDocument


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