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

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.CharacterImpl
              extended by org.apache.axiom.om.impl.dom.TextImpl
All Implemented Interfaces:
Cloneable, OMNodeEx, OMNode, OMText, org.w3c.dom.CharacterData, org.w3c.dom.Node, org.w3c.dom.NodeList, org.w3c.dom.Text

public class TextImpl
extends CharacterImpl
implements org.w3c.dom.Text, OMText


Field Summary
protected  OMAttribute attribute
          Field attribute is used when serializing Binary stuff as MTOM optimized.
protected  char[] charArray
           
protected  String localName
          Field localName is used when serializing Binary stuff as MTOM optimized.
protected  OMNamespace ns
          Field nameSpace is used when serializing Binary stuff as MTOM optimized.
protected  OMNamespace textNS
           
static OMNamespace XOP_NS
          Field nameSpace used when serializing Binary stuff as MTOM optimized.
 
Fields inherited from class org.apache.axiom.om.impl.dom.CharacterImpl
textValue
 
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.OMNode
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE
 
Constructor Summary
TextImpl(DocumentImpl ownerNode, char[] value, OMFactory factory)
           
TextImpl(DocumentImpl ownerNode, Object dataHandler, boolean optimize, OMFactory factory)
           
TextImpl(DocumentImpl ownerNode, OMFactory factory)
           
TextImpl(DocumentImpl ownerNode, String value, OMFactory factory)
           
TextImpl(DocumentImpl ownerNode, String value, String mimeType, boolean optimize, OMFactory factory)
           
TextImpl(OMContainer parent, javax.xml.namespace.QName text, int nodeType, OMFactory factory)
           
TextImpl(OMContainer parent, javax.xml.namespace.QName text, OMFactory factory)
           
TextImpl(OMContainer parent, TextImpl source, OMFactory factory)
          Construct TextImpl that is a copy of the source OMTextImpl
TextImpl(String contentID, OMContainer parent, OMXMLParserWrapper builder, OMFactory factory)
           
TextImpl(String text, OMFactory factory)
          Creates a text node with the given text required by the OMDOMFactory.
TextImpl(String text, String mimeType, boolean optimize, boolean isBinary, OMFactory factory)
           
TextImpl(String text, String mimeType, boolean optimize, OMFactory factory)
           
 
Method Summary
 void buildWithAttachments()
          Parses this node and builds the object structure in memory.
 org.w3c.dom.Node cloneNode(boolean deep)
           
 void discard()
          Discards a node.
 String getContentID()
          Gets the content id.
 String getData()
          Returns the value of the data.
 Object getDataHandler()
          Gets the datahandler.
 InputStream getInputStream()
           
 String getLocalName()
           
 OMNamespace getNamespace()
          Returns the Namespace if this contains a QName Return null otherwise
 String getNodeName()
           
 short getNodeType()
           
 String getNodeValue()
           
 String getText()
          Returns the text value of this node.
 javax.xml.namespace.QName getTextAsQName()
           
 char[] getTextCharacters()
           
 int getType()
          Returns the type of node.
 String getWholeText()
           
 void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
          Serializes the node with caching.
 void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
          Serializes the node without caching.
 boolean isBinary()
           
 boolean isCharacters()
           
 boolean isElementContentWhitespace()
           
 boolean isOptimized()
           
 org.w3c.dom.Text replaceWholeText(String arg0)
           
 void setBinary(boolean value)
          Receiving binary can happen as either MTOM attachments or as Base64 Text In the case of Base64 user has to explicitly specify that the content is binary, before calling getDataHandler(), getInputStream()....
 void setContentID(String cid)
          Set a specific content id
 void setOptimize(boolean value)
          Sets the optimize flag.
 void setType(int nodeType)
           
 org.w3c.dom.Text splitText(int offset)
          Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings.
 String toString()
           
 
Methods inherited from class org.apache.axiom.om.impl.dom.CharacterImpl
appendData, deleteData, getLength, insertData, replaceData, setData, substringData
 
Methods inherited from class org.apache.axiom.om.impl.dom.ChildNode
detach, getNextOMSibling, getNextSibling, getParent, getParentNode, getPreviousOMSibling, getPreviousSibling, insertSiblingAfter, insertSiblingBefore, setNextOMSibling, setParent, setPreviousOMSibling
 
Methods inherited from class org.apache.axiom.om.impl.dom.NodeImpl
appendChild, build, close, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNamespaceURI, getOMFactory, getOwnerDocument, getPrefix, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, internalSerializeWithCache, isComplete, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNodeValue, setOwnerDocument, setPrefix, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.CharacterData
appendData, deleteData, getLength, insertData, replaceData, setData, substringData
 
Methods inherited from interface org.w3c.dom.Node
appendChild, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNamespaceURI, getNextSibling, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 
Methods inherited from interface org.apache.axiom.om.OMNode
build, close, detach, getNextOMSibling, getOMFactory, getParent, getPreviousOMSibling, insertSiblingAfter, insertSiblingBefore, isComplete, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
 

Field Detail

textNS

protected OMNamespace textNS

charArray

protected char[] charArray

ns

protected OMNamespace ns
Field nameSpace is used when serializing Binary stuff as MTOM optimized.


localName

protected String localName
Field localName is used when serializing Binary stuff as MTOM optimized.


attribute

protected OMAttribute attribute
Field attribute is used when serializing Binary stuff as MTOM optimized.


XOP_NS

public static final OMNamespace XOP_NS
Field nameSpace used when serializing Binary stuff as MTOM optimized.

Constructor Detail

TextImpl

public TextImpl(String text,
                OMFactory factory)
Creates a text node with the given text required by the OMDOMFactory. The owner document should be set properly when appending this to a DOM tree.

Parameters:
text -

TextImpl

public TextImpl(String contentID,
                OMContainer parent,
                OMXMLParserWrapper builder,
                OMFactory factory)
Parameters:
contentID -
parent -
builder - Used when the builder is encountered with a XOP:Include tag Stores a reference to the builder and the content-id. Supports deffered parsing of MIME messages

TextImpl

public TextImpl(OMContainer parent,
                TextImpl source,
                OMFactory factory)
Construct TextImpl that is a copy of the source OMTextImpl

Parameters:
parent -
source - TextImpl
factory -

TextImpl

public TextImpl(String text,
                String mimeType,
                boolean optimize,
                OMFactory factory)

TextImpl

public TextImpl(String text,
                String mimeType,
                boolean optimize,
                boolean isBinary,
                OMFactory factory)

TextImpl

public TextImpl(DocumentImpl ownerNode,
                Object dataHandler,
                boolean optimize,
                OMFactory factory)
Parameters:
dataHandler -
optimize - To send binary content. Created progrmatically.

TextImpl

public TextImpl(DocumentImpl ownerNode,
                OMFactory factory)
Parameters:
ownerNode -

TextImpl

public TextImpl(DocumentImpl ownerNode,
                String value,
                OMFactory factory)
Parameters:
ownerNode -
value -

TextImpl

public TextImpl(DocumentImpl ownerNode,
                char[] value,
                OMFactory factory)

TextImpl

public TextImpl(DocumentImpl ownerNode,
                String value,
                String mimeType,
                boolean optimize,
                OMFactory factory)
Parameters:
ownerNode -
value -

TextImpl

public TextImpl(OMContainer parent,
                javax.xml.namespace.QName text,
                OMFactory factory)

TextImpl

public TextImpl(OMContainer parent,
                javax.xml.namespace.QName text,
                int nodeType,
                OMFactory factory)
Method Detail

splitText

public org.w3c.dom.Text splitText(int offset)
                           throws org.w3c.dom.DOMException
Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings. After being split, this node will contain all the content up to the offset point. A new node of the same type, which contains all the content at and after the offset point, is returned. If the original node had a parent node, the new node is inserted as the next sibling of the original node. When the offset is equal to the length of this node, the new node has no data.

Specified by:
splitText in interface org.w3c.dom.Text
Throws:
org.w3c.dom.DOMException

getNodeName

public String getNodeName()
Specified by:
getNodeName in interface org.w3c.dom.Node

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface org.w3c.dom.Node

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, OMNode.SPACE_NODE, or OMNode.TEXT_NODE.
Throws:
OMException

setType

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

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
                       throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNodeEx
Serializes the node with caching.

Specified by:
internalSerialize in interface OMNodeEx
Throws:
javax.xml.stream.XMLStreamException

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
                                 throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNodeEx
Serializes the node without caching.

Specified by:
internalSerializeAndConsume in interface OMNodeEx
Throws:
javax.xml.stream.XMLStreamException

isOptimized

public boolean isOptimized()
Specified by:
isOptimized in interface OMText
Returns:
Returns boolean flag saying whether the node contains an optimized text or not.

setOptimize

public void setOptimize(boolean value)
Description copied from interface: OMText
Sets the optimize flag.

Specified by:
setOptimize in interface OMText
Parameters:
value - true to optimize binary content (usually w/MTOM)

discard

public void discard()
             throws OMException
Description copied from interface: OMNode
Discards a node.

Discard goes to the parser level and if the element is not completely built, then it will be completely skipped at the parser level.

Specified by:
discard in interface OMNode
Overrides:
discard in class ChildNode
Throws:
OMException

getText

public String getText()
Description copied from interface: OMText
Returns the text value of this node.

Specified by:
getText in interface OMText
Returns:
Returns String.

getData

public String getData()
               throws org.w3c.dom.DOMException
Description copied from class: CharacterImpl
Returns the value of the data.

Specified by:
getData in interface org.w3c.dom.CharacterData
Overrides:
getData in class CharacterImpl
Throws:
org.w3c.dom.DOMException

getTextCharacters

public char[] getTextCharacters()
Specified by:
getTextCharacters in interface OMText

isCharacters

public boolean isCharacters()
Specified by:
isCharacters in interface OMText

getTextAsQName

public javax.xml.namespace.QName getTextAsQName()
Specified by:
getTextAsQName in interface OMText

getNodeValue

public String getNodeValue()
                    throws org.w3c.dom.DOMException
Specified by:
getNodeValue in interface org.w3c.dom.Node
Overrides:
getNodeValue in class NodeImpl
Throws:
org.w3c.dom.DOMException

getContentID

public String getContentID()
Description copied from interface: OMText
Gets the content id.

Specified by:
getContentID in interface OMText
Returns:
Returns String.

getDataHandler

public Object getDataHandler()
Description copied from interface: OMText
Gets the datahandler.

Specified by:
getDataHandler in interface OMText
Returns:
Returns datahandler.

getInputStream

public InputStream getInputStream()
                           throws OMException
Throws:
OMException

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Specified by:
cloneNode in interface org.w3c.dom.Node
Overrides:
cloneNode in class ChildNode

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface org.w3c.dom.Node
Overrides:
getLocalName in class NodeImpl

getWholeText

public String getWholeText()
Specified by:
getWholeText in interface org.w3c.dom.Text

isElementContentWhitespace

public boolean isElementContentWhitespace()
Specified by:
isElementContentWhitespace in interface org.w3c.dom.Text

replaceWholeText

public org.w3c.dom.Text replaceWholeText(String arg0)
                                  throws org.w3c.dom.DOMException
Specified by:
replaceWholeText in interface org.w3c.dom.Text
Throws:
org.w3c.dom.DOMException

toString

public String toString()
Overrides:
toString in class Object

buildWithAttachments

public void buildWithAttachments()
Description copied from class: NodeImpl
Parses this node and builds the object structure in memory. AXIOM supports two levels of deffered building. First is deffered building of AXIOM using StAX. Second level is the deffered building of attachments. AXIOM reads in the attachements from the stream only when user asks by calling getDataHandler(). build() method builds the OM without the attachments. buildAll() builds the OM together with attachement data. This becomes handy when user wants to free the input stream.

Specified by:
buildWithAttachments in interface OMNode
Overrides:
buildWithAttachments in class NodeImpl

isBinary

public boolean isBinary()
Specified by:
isBinary in interface OMText
Returns:
Returns boolean flag saying whether the node contains binary or not.

setBinary

public void setBinary(boolean value)
Receiving binary can happen as either MTOM attachments or as Base64 Text In the case of Base64 user has to explicitly specify that the content is binary, before calling getDataHandler(), getInputStream()....

Specified by:
setBinary in interface OMText
Parameters:
value - true if the content is binary

getNamespace

public OMNamespace getNamespace()
Description copied from interface: OMText
Returns the Namespace if this contains a QName Return null otherwise

Specified by:
getNamespace in interface OMText
Returns:
OMNamespace

setContentID

public void setContentID(String cid)
Description copied from interface: OMText
Set a specific content id

Specified by:
setContentID in interface OMText


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