public class MessageElement extends NodeImpl implements SOAPElement, Serializable, NodeList, Cloneable
| Modifier and Type | Class and Description |
|---|---|
protected static class |
MessageElement.QNameAttr
class that represents a qname in a the qNameAttrs vector.
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_isRoot |
protected DeserializationContext |
context |
protected String |
encodingStyle
Our encoding style, if any
|
protected int |
endEventIndex |
protected Deserializer |
fixupDeserializer
!!!
|
protected String |
href |
protected String |
id |
protected static org.apache.commons.logging.Log |
log |
protected SOAPEnvelope |
message |
ArrayList |
namespaces |
protected Vector |
qNameAttrs |
protected SAX2EventRecorder |
recorder |
protected int |
startContentsIndex |
protected int |
startEventIndex |
protected QName |
typeQName |
_isDirty, attributes, children, document, name, namespaceURI, parent, prefix, textRepATTRIBUTE_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| Constructor and Description |
|---|
MessageElement()
No-arg constructor for building messages?
|
MessageElement(CharacterData text)
construct a text element.
|
MessageElement(Element elem)
create a node through a deep copy of the passed in element.
|
MessageElement(Name eltName)
construct using a
Name implementation, |
MessageElement(QName name)
constructor declaring the qualified name of the node
|
MessageElement(QName name,
Object value)
constructor declaring the qualified name of the node
and its value
|
MessageElement(String namespace,
String localPart)
constructor
|
MessageElement(String namespace,
String localPart,
Object value)
constructor binding the internal object value field to the
value parameter
|
MessageElement(String localPart,
String prefix,
String namespace)
constructor.
|
MessageElement(String namespace,
String localPart,
String prefix,
Attributes attributes,
DeserializationContext context)
Advanced constructor used for deserialization.
|
| Modifier and Type | Method and Description |
|---|---|
SOAPElement |
addAttribute(Name attrName,
String value)
add a new attribute
|
void |
addAttribute(String namespace,
String localName,
QName value)
add an attribute to the qname vector.
|
void |
addAttribute(String namespace,
String localName,
String value)
add a normal CDATA/text attribute.
|
void |
addAttribute(String attrPrefix,
String namespace,
String localName,
String value)
add an attribute.
|
void |
addChild(MessageElement el)
Note that this method will log a error and no-op if there is
a value (set using setObjectValue) in the MessageElement.
|
SOAPElement |
addChildElement(Name childName)
add the child element
|
SOAPElement |
addChildElement(SOAPElement element)
The added child must be an instance of MessageElement rather than
an abitrary SOAPElement otherwise a (wrapped) ClassCastException
will be thrown.
|
SOAPElement |
addChildElement(String localName)
add a child element in the message element's own namespace
|
SOAPElement |
addChildElement(String localName,
String prefixName)
add a child element
|
SOAPElement |
addChildElement(String localName,
String childPrefix,
String uri)
add a child element
|
void |
addMapping(Mapping map)
add a new namespace/prefix mapping
|
SOAPElement |
addNamespaceDeclaration(String prefix,
String uri)
create a
Mapping mapping and add to our namespace list. |
SOAPElement |
addTextNode(String s)
add a text node to the document.
|
protected void |
childDeepCloned(NodeImpl oldNode,
NodeImpl newNode) |
Node |
cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy
constructor for nodes.
|
protected Object |
cloning()
protected clone method (not public)
copied status
-------------------
protected String name ; Y
protected String prefix ; Y
protected String namespaceURI ; Y
protected transient Attributes attributes Y
protected String id; Y?
|
void |
detachAllChildren()
remove all children.
|
boolean |
equals(Object obj)
equality test.
|
protected MessageElement |
findElement(Vector vec,
String namespace,
String localPart) |
Iterator |
getAllAttributes()
Get an interator to all the attributes of the node.
|
Document |
getAsDocument()
get the message element as a document.
|
Element |
getAsDOM()
create a DOM from the message element, by
serializing and deserializing the element
|
String |
getAsString()
get the message element as a string.
|
String |
getAttribute(String attrName)
get an attribute by name
|
Attr |
getAttributeNode(String attrName)
Deprecated.
this is not implemented
|
Attr |
getAttributeNodeNS(String namespace,
String localName)
Deprecated.
not implemented!
|
String |
getAttributeNS(String namespaceURI,
String localName)
get the attribute with namespace/local name match.
|
Attributes |
getAttributesEx()
get the attributes
|
String |
getAttributeValue(Name attrName)
Get the value of an attribute whose namespace and local name are described.
|
String |
getAttributeValue(String localName)
get the value of an attribute
|
MessageElement |
getChildElement(QName qname)
Convenience method to get the first matching child for a given QName.
|
Iterator |
getChildElements()
get an iterator over the children
This iterator may get confused if changes are made to the
children while the iteration is in progress.
|
Iterator |
getChildElements(Name childName)
get an iterator over child elements
|
Iterator |
getChildElements(QName qname)
get an iterator over child elements
|
List |
getChildren()
get a list of children
|
Attributes |
getCompleteAttributes()
Obtain an Attributes collection consisting of all attributes
for this MessageElement, including namespace declarations.
|
DeserializationContext |
getDeserializationContext()
Retrieve the DeserializationContext associated with this MessageElement
|
Name |
getElementName()
get the full name of the element
|
NodeList |
getElementsByTagName(String tagName) |
NodeList |
getElementsByTagNameNS(String namespace,
String localName) |
protected NodeList |
getElementsNS(Element parentElement,
String namespace,
String localName)
helper method for recusively getting the element that has namespace URI and localname
|
String |
getEncodingStyle()
Get the encoding style.
|
SOAPEnvelope |
getEnvelope()
get our current envelope
|
Deserializer |
getFixupDeserializer() |
String |
getHref()
get a saved href
|
String |
getID()
get a saved ID
|
int |
getLength()
The number of nodes in the list.
|
String |
getName()
get the local name of this element
|
Iterator |
getNamespacePrefixes()
get an iterator of the prefixes.
|
String |
getNamespaceURI(String searchPrefix)
map from a prefix to a namespace.
|
Object |
getObjectValue()
Returns value of the node as an object of registered type.
|
Object |
getObjectValue(Class cls)
Returns value of the node as an object of registered type.
|
Document |
getOwnerDocument()
The
Document object associated with this node. |
String |
getPrefix(String searchNamespaceURI)
get the prefix for a given namespace URI
|
QName |
getQName()
get the fully qualified name of this element
|
MessageElement |
getRealElement()
get the 'real' element -will follow hrefs.
|
SAX2EventRecorder |
getRecorder()
get the event recorder
|
String |
getTagName() |
QName |
getType()
get the element's type.
|
String |
getValue()
Get the value of the doc as a string.
|
Object |
getValueAsType(QName type) |
Object |
getValueAsType(QName type,
Class cls)
This is deserialization logic mixed in to our element class.
|
protected String |
getValueDOM() |
Iterator |
getVisibleNamespacePrefixes()
get an iterator over visible prefixes.
|
boolean |
hasAttribute(String attrName)
test for an attribute existing
|
boolean |
hasAttributeNS(String namespace,
String localName)
Test for an attribute
|
boolean |
isRoot()
get the is-root flag
|
Node |
item(int index)
get a child node
|
void |
output(SerializationContext outputContext)
This is the public output() method, which will always simply use
the recorded SAX stream for this element if it is available.
|
protected void |
outputImpl(SerializationContext outputContext)
override point -output to a serialization context.
|
void |
publishContents(ContentHandler handler)
replay the sax events to a SAX content handles
|
void |
publishToHandler(ContentHandler handler)
replay the sax events to a handler
|
boolean |
removeAttribute(Name attrName)
remove an element
|
void |
removeAttribute(String attrName)
remove a named attribute.
|
Attr |
removeAttributeNode(Attr oldAttr)
remove a an attribue
|
void |
removeAttributeNS(String namespace,
String localName)
Remove an attribute.
|
void |
removeContents()
remove all chidlren.
|
boolean |
removeNamespaceDeclaration(String namespacePrefix)
remove a namespace declaration.
|
void |
setAllAttributes(Attributes attrs)
set all the attributes of this instance
|
void |
setAttribute(String name,
String value)
set or update an attribute.
|
void |
setAttribute(String namespace,
String localName,
String value)
Set an attribute, adding the attribute if it isn't already present
in this element, and changing the value if it is.
|
Attr |
setAttributeNode(Attr newAttr)
Deprecated.
this is not implemented
|
Attr |
setAttributeNodeNS(Attr newAttr)
set an attribute as a node
|
void |
setAttributeNS(String namespaceURI,
String qualifiedName,
String value)
set an attribute or alter an existing one
|
void |
setContentsIndex(int index)
set the index point of our content's starting in the
event recording
|
void |
setEncodingStyle(String encodingStyle)
Sets the encoding style for this
SOAPElement
object to one specified. |
void |
setEndIndex(int endIndex)
record the end index of the SAX recording.
|
void |
setEnvelope(SOAPEnvelope env)
bind a a new soap envelope. sets the dirty bit.
|
void |
setFixupDeserializer(Deserializer dser) |
void |
setName(String name)
set the local part of this element's name
|
void |
setNamespaceURI(String nsURI)
set the namespace URI of the element
|
void |
setNSMappings(ArrayList namespaces)
set a new namespace mapping list
|
void |
setObjectValue(Object newValue)
Sets value of this node to an Object.
|
void |
setQName(QName qName)
set the name and namespace of this element
|
void |
setRecorder(SAX2EventRecorder rec)
set the event recorder
|
void |
setType(QName qname)
set the element's type
|
void |
setValue(String value)
If this is a Text node then this method will set its value, otherwise it
sets the value of the immediate (Text) child of this node.
|
String |
toString()
Generate a string representation by serializing our contents
This is not a lightweight operation, and is repeated whenever
you call this method.
|
appendChild, convertAttrSAXtoDOM, detachNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getParent, getParentElement, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, initializeChildren, insertBefore, isDirty, isSupported, makeAttributesEditable, normalize, recycleNode, removeChild, replaceChild, reset, setDirty, setDirty, setNodeValue, setOwnerDocument, setParent, setParentElement, setPrefixclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdetachNode, getParentElement, recycleNode, setParentElementgetSchemaTypeInfo, setIdAttribute, setIdAttributeNode, setIdAttributeNSappendChild, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserDataprotected static org.apache.commons.logging.Log log
protected String id
protected String href
protected boolean _isRoot
protected SOAPEnvelope message
protected transient DeserializationContext context
protected transient QName typeQName
protected Vector qNameAttrs
protected transient SAX2EventRecorder recorder
protected int startEventIndex
protected int startContentsIndex
protected int endEventIndex
public ArrayList namespaces
protected String encodingStyle
protected Deserializer fixupDeserializer
public MessageElement()
public MessageElement(String namespace, String localPart)
namespace - namespace of elementlocalPart - local namepublic MessageElement(String localPart, String prefix, String namespace)
localPart - local nameprefix - prefixnamespace - namespacepublic MessageElement(Name eltName)
Name implementation,eltName - MessageElement(String, String, String)public MessageElement(String namespace, String localPart, Object value)
namespace - namespace of the elementlocalPart - local namevalue - value of the nodepublic MessageElement(QName name)
name - naming informationpublic MessageElement(QName name, Object value)
name - naming informationvalue - value of the nodepublic MessageElement(Element elem)
elem - name to copy frompublic MessageElement(CharacterData text)
text - text data. This is not copied; it is referred to in the MessageElement.public MessageElement(String namespace, String localPart, String prefix, Attributes attributes, DeserializationContext context) throws AxisFault
DeserializationContext.registerElementByID(String, MessageElement) ;a new recorder is
created if needed.
typeQName field appropriately.
href field is set if there is a relevant href value
namespace - namespace namespace of elementlocalPart - local name local name of elementprefix - prefix prefix of elementattributes - attributes to save as our attributescontext - deserialization context for this message elementAxisFault - if the encoding style is not recognized/supportedpublic DeserializationContext getDeserializationContext()
public void setFixupDeserializer(Deserializer dser)
public Deserializer getFixupDeserializer()
public void setEndIndex(int endIndex)
endIndex - end valuepublic boolean isRoot()
public String getID()
public String getHref()
public Attributes getAttributesEx()
NullAttributes.singleton it is nullpublic Node cloneNode(boolean deep)
parentNode is null.).
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 an Attribute
directly, as opposed to be cloned as part of an Element
cloning operation, returns a specified attribute (
specified is true). Cloning any other type
of node simply returns a copy of this node.
EntityReference clone are readonly
. In addition, clones of unspecified Attr nodes are
specified. And, cloning Document,
DocumentType, Entity, and
Notation nodes is implementation dependent.protected Object cloning() throws CloneNotSupportedException
CloneNotSupportedExceptionpublic void setAllAttributes(Attributes attrs)
attrs - a new attributes listpublic void detachAllChildren()
public Attributes getCompleteAttributes()
public String getName()
public void setName(String name)
name - public QName getQName()
public void setQName(QName qName)
qName - qualified namepublic void setNamespaceURI(String nsURI)
nsURI - new namespace URIpublic QName getType()
public void setType(QName qname)
qname - public SAX2EventRecorder getRecorder()
public void setRecorder(SAX2EventRecorder rec)
rec - public String getEncodingStyle()
getEncodingStyle in interface SOAPElementsetEncodingStyle(java.lang.String)public void removeContents()
removeContents in interface SOAPElementpublic Iterator getVisibleNamespacePrefixes()
getVisibleNamespacePrefixes in interface SOAPElementpublic void setEncodingStyle(String encodingStyle) throws SOAPException
SOAPElement
object to one specified. The semantics of a null value,
as above in getEncodingStyle() are to just use the parent's value,
but null here means set to "".setEncodingStyle in interface SOAPElementencodingStyle - a String
giving the encoding styleIllegalArgumentException - if
there was a problem in the encoding style being set.SOAPExceptiongetEncodingStyle()public void addChild(MessageElement el) throws SOAPException
SOAPExceptionpublic List getChildren()
public void setContentsIndex(int index)
index - index value of the first event of our recorder.public void setNSMappings(ArrayList namespaces)
namespaces - public String getPrefix(String searchNamespaceURI)
searchNamespaceURI - namespacepublic String getNamespaceURI(String searchPrefix)
getNamespaceURI in interface SOAPElementsearchPrefix - public Object getObjectValue()
public Object getObjectValue(Class cls) throws Exception
cls - Class that contains top level deserializer metadataExceptionpublic void setObjectValue(Object newValue) throws SOAPException
Note that this method will log an error and no-op if there are any children in the MessageElement or if the MessageElement was constructed from XML.
newValue - node's value or null.SOAPExceptionpublic Object getValueAsType(QName type, Class cls) throws Exception
MessageElement(String, String, String, org.xml.sax.Attributes, org.apache.axis.encoding.DeserializationContext)type - type to look up a deserializer for.cls - class to use for looking up the deserializer. This takes precedence over the type field.Exceptionpublic void addAttribute(String namespace, String localName, QName value)
namespace - localName - value - public void addAttribute(String namespace, String localName, String value)
namespace - namespace URIlocalName - local anmevalue - valuepublic void addAttribute(String attrPrefix, String namespace, String localName, String value)
attrPrefix - prefix.namespace - namespace URIlocalName - value - public void setAttribute(String namespace, String localName, String value)
public String getAttributeValue(String localName)
localName - public void setEnvelope(SOAPEnvelope env)
env - public SOAPEnvelope getEnvelope()
public MessageElement getRealElement()
public Document getAsDocument() throws Exception
ExceptiongetAsString()public String getAsString() throws Exception
Exception - if anything went wrongpublic Element getAsDOM() throws Exception
ExceptiongetAsString(),
getAsDocument()public void publishToHandler(ContentHandler handler) throws SAXException
handler - SAXExceptionpublic void publishContents(ContentHandler handler) throws SAXException
handler - SAXExceptionpublic final void output(SerializationContext outputContext) throws Exception
protected void outputImpl(SerializationContext outputContext) throws Exception
outputContext - destination.Exception - if something went wrong.public String toString()
Object.toString() operation invoked instead.public void addMapping(Mapping map)
map - new mapping to addpublic SOAPElement addChildElement(Name childName) throws SOAPException
addChildElement in interface SOAPElementchildName - uri, prefix and local name of the element to addSOAPExceptionSOAPElement.addChildElement(javax.xml.soap.Name)public SOAPElement addChildElement(String localName) throws SOAPException
addChildElement in interface SOAPElementlocalName - SOAPExceptionSOAPElement.addChildElement(String)public SOAPElement addChildElement(String localName, String prefixName) throws SOAPException
addChildElement in interface SOAPElementlocalName - prefixName - SOAPExceptionSOAPElement.addChildElement(String, String)public SOAPElement addChildElement(String localName, String childPrefix, String uri) throws SOAPException
addChildElement in interface SOAPElementlocalName - childPrefix - uri - SOAPExceptionSOAPElement.addChildElement(String, String, String)public SOAPElement addChildElement(SOAPElement element) throws SOAPException
addChildElement in interface SOAPElementelement - the SOAPElement to be added as a
new childSOAPException - if there was an error in adding this
element as a childSOAPElement.addChildElement(javax.xml.soap.SOAPElement)public SOAPElement addTextNode(String s) throws SOAPException
addTextNode in interface SOAPElements - a String object with the textual content to be addedSOAPException - if there is an error in creating the
new Text objectSOAPElement.addTextNode(String)public SOAPElement addAttribute(Name attrName, String value) throws SOAPException
addAttribute in interface SOAPElementattrName - name of the attributevalue - a string valueSOAPExceptionSOAPElement.addAttribute(javax.xml.soap.Name, String)public SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException
Mapping mapping and add to our namespace list.addNamespaceDeclaration in interface SOAPElementprefix - uri - SOAPException - for any RuntimeException caughtSOAPElement.addNamespaceDeclaration(String, String)public String getAttributeValue(Name attrName)
getAttributeValue in interface SOAPElementattrName - qualified name of the attributeSOAPElement.getAttributeValue(javax.xml.soap.Name)public Iterator getAllAttributes()
getAllAttributes in interface SOAPElementSOAPElement.getAllAttributes()public Iterator getNamespacePrefixes()
getNamespacePrefixes in interface SOAPElementSOAPElement.getNamespacePrefixes()public Name getElementName()
getElementName in interface SOAPElementSOAPElement.getElementName()public boolean removeAttribute(Name attrName)
removeAttribute in interface SOAPElementattrName - name of the elementSOAPElement.removeAttribute(javax.xml.soap.Name)public boolean removeNamespaceDeclaration(String namespacePrefix)
removeNamespaceDeclaration in interface SOAPElementnamespacePrefix - SOAPElement.removeNamespaceDeclaration(String)public Iterator getChildElements()
getChildElements in interface SOAPElementSOAPElement.getChildElements()public MessageElement getChildElement(QName qname)
qname - SOAPElement.getChildElements()public Iterator getChildElements(QName qname)
qname - namespace/element name of parts to find.
This iterator is not (currently) susceptible to change in the element
list during its lifetime, though changes in the contents of the elements
are picked up.public Iterator getChildElements(Name childName)
getChildElements in interface SOAPElementchildName - namespace/element name of parts to find.
This iterator is not (currently) susceptible to change in the element
list during its lifetime, though changes in the contents of the elements
are picked up.SOAPElement.getChildElements(javax.xml.soap.Name)public String getTagName()
getTagName in interface ElementElement.getTagName()public void removeAttribute(String attrName) throws DOMException
removeAttribute in interface ElementattrName - name of the attributesDOMExceptionElement.removeAttribute(String)public boolean hasAttribute(String attrName)
hasAttribute in interface ElementattrName - name of attribute (or null)Element.hasAttribute(String)public String getAttribute(String attrName)
getAttribute in interface ElementattrName - of attributeElement.getAttribute(String)public void removeAttributeNS(String namespace, String localName) throws DOMException
removeAttributeNS in interface Elementnamespace - namespace of attrlocalName - local nameDOMExceptionElement.removeAttributeNS(String, String)public void setAttribute(String name, String value) throws DOMException
setAttribute in interface Elementname - attribute namevalue - attribute valueDOMExceptionElement.setAttribute(String, String)public boolean hasAttributeNS(String namespace, String localName)
hasAttributeNS in interface Elementnamespace - localName - Element.hasAttributeNS(String, String)public Attr getAttributeNode(String attrName)
getAttributeNode in interface ElementattrName - Element.getAttributeNode(String)public Attr removeAttributeNode(Attr oldAttr) throws DOMException
removeAttributeNode in interface ElementoldAttr - DOMExceptionpublic Attr setAttributeNode(Attr newAttr) throws DOMException
setAttributeNode in interface ElementnewAttr - DOMExceptionElement.setAttributeNode(org.w3c.dom.Attr)public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
setAttributeNodeNS in interface ElementnewAttr - DOMExceptionElement.setAttributeNodeNS(org.w3c.dom.Attr)public NodeList getElementsByTagName(String tagName)
getElementsByTagName in interface ElementtagName - tag to look for.Element.getElementsByTagName(String)public String getAttributeNS(String namespaceURI, String localName)
getAttributeNS in interface ElementnamespaceURI - namespacelocalName - nameElement.getAttributeNS(String, String)public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException
setAttributeNS in interface ElementnamespaceURI - namepsacequalifiedName - qualified name of the attribuevalue - valueDOMExceptionElement.setAttributeNS(String, String, String)public Attr getAttributeNodeNS(String namespace, String localName)
getAttributeNodeNS in interface Elementnamespace - namespacelocalName - local nameElement.getAttributeNS(String, String)public NodeList getElementsByTagNameNS(String namespace, String localName)
getElementsByTagNameNS in interface Elementnamespace - namespacelocalName - local name of elementElement.getElementsByTagNameNS(String, String)protected NodeList getElementsNS(Element parentElement, String namespace, String localName)
parentElement - parent elementnamespace - namespacelocalName - local name of elementpublic Node item(int index)
item in interface NodeListindex - index valueNodeList.item(int)public int getLength()
length-1 inclusive.getLength in interface NodeListNodeList.getLength()protected MessageElement findElement(Vector vec, String namespace, String localPart)
public boolean equals(Object obj)
equals in class Objectobj - toString()public String getValue()
getAsDOM() so is a heavyweight operation.protected String getValueDOM()
public void setValue(String value)
NodeImplpublic Document getOwnerDocument()
NodeImplDocument object associated with this node. This is
also the Document object used to create new nodes. When
this node is a Document or a DocumentType
which is not used with any Document yet, this is
null.getOwnerDocument in interface NodegetOwnerDocument in class NodeImplCopyright © The Apache Software Foundation. All Rights Reserved.