org.apache.axis.message
public class MessageElement extends NodeImpl implements SOAPElement, Serializable, NodeList, Cloneable
UNKNOWN: implement the NodeList methods properly, with tests.
Nested Class Summary | |
---|---|
protected static class | MessageElement.QNameAttr
class that represents a qname in a the qNameAttrs vector. |
Field Summary | |
---|---|
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 Log | log |
protected SOAPEnvelope | message |
ArrayList | namespaces |
protected Vector | qNameAttrs |
protected SAX2EventRecorder | recorder |
protected int | startContentsIndex |
protected int | startEventIndex |
protected QName | typeQName |
protected boolean | _isRoot |
Constructor Summary | |
---|---|
MessageElement() No-arg constructor for building messages? | |
MessageElement(String namespace, String localPart)
constructor | |
MessageElement(String localPart, String prefix, String namespace)
constructor. | |
MessageElement(Name eltName)
construct using a {@link javax.xml.soap.Name} implementation, | |
MessageElement(String namespace, String localPart, Object value)
constructor binding the internal object value field to the
value parameter | |
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(Element elem)
create a node through a deep copy of the passed in element. | |
MessageElement(CharacterData text)
construct a text element. | |
MessageElement(String namespace, String localPart, String prefix, Attributes attributes, DeserializationContext context)
Advanced constructor used for deserialization.
|
Method Summary | |
---|---|
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.
|
SOAPElement | addAttribute(Name attrName, String value)
add a new 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(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 |
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. |
void | addMapping(Mapping map)
add a new namespace/prefix mapping |
SOAPElement | addNamespaceDeclaration(String prefix, String uri)
create a {@link 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)
This unimplemented operation is meand to return an attribute as a node |
Attr | getAttributeNodeNS(String namespace, String localName) |
String | getAttributeNS(String namespaceURI, String localName)
get the attribute with namespace/local name match. |
Attributes | getAttributesEx()
get the attributes |
String | getAttributeValue(String localName)
get the value of an attribute |
String | getAttributeValue(Name attrName)
Get the value of an attribute whose namespace and local name are described. |
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(QName qname)
get an iterator over child elements |
Iterator | getChildElements(Name childName)
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() |
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 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. |
void | setAttribute(String name, String value)
set or update an attribute. |
Attr | setAttributeNode(Attr newAttr)
set the attribute node. |
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) |
String | toString()
Generate a string representation by serializing our contents
This is not a lightweight operation, and is repeated whenever
you call this method.
|
Parameters: namespace namespace of element localPart local name
Parameters: localPart local name prefix prefix namespace namespace
Parameters: eltName
See Also: MessageElement
Parameters: namespace namespace of the element localPart local name value value of the node
Parameters: name naming information
Parameters: name naming information value value of the node
Parameters: elem name to copy from
Parameters: text text data. This is not copied; it is referred to in the MessageElement.
Parameters: namespace namespace namespace of element localPart local name local name of element prefix prefix prefix of element attributes attributes to save as our attributes context deserialization context for this message element
Throws: AxisFault if the encoding style is not recognized/supported
Parameters: namespace localName value
Parameters: namespace namespace URI localName local anme value value
Parameters: attrPrefix prefix. namespace namespace URI localName value
Parameters: attrName name of the attribute value a string value
Returns: ourselves
Throws: SOAPException
See Also: SOAPElement
Parameters: childName uri, prefix and local name of the element to add
Returns: the child element
Throws: SOAPException
See Also: addChildElement
Parameters: localName
Returns: the child element
Throws: SOAPException
See Also: addChildElement
Parameters: localName prefixName
Returns: the child element
Throws: SOAPException
See Also: SOAPElement
Parameters: localName childPrefix uri
Returns: the child element
Throws: SOAPException
See Also: SOAPElement
See Also: addChildElement
Parameters: map new mapping to add
UNKNOWN: this code does not verify that the mapping does not exist already; it is possible to create duplicate mappings.
Parameters: prefix uri
Returns:
Throws: SOAPException for any {@link RuntimeException} caught
See Also: SOAPElement
UNKNOWN: for some reason this logic catches all rutime exceptions and rethrows them as SOAPExceptions. This is unusual behavio, and should be looked at closely.
Returns: ourselves
See Also: addTextNode
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.
Parameters: deep If true
, recursively clone the subtree under
the specified node; if false
, clone only the node
itself (and its attributes, if it is an Element
).
Returns: The duplicate node.
Returns:
Throws: CloneNotSupportedException
Parameters: obj
Returns:
See Also: toString
Returns: an iterator of the attributes.
See Also: getAllAttributes
Returns:
Throws: Exception
See Also: getAsString
Returns: the root document element of the element
Throws: Exception
See Also: getAsString getAsDocument
Returns: an XML fragment in a string.
Throws: Exception if anything went wrong
Parameters: attrName of attribute
Returns: the attribute value or null
See Also: org.w3c.dom.Element#getAttribute(String)
Deprecated: this is not implemented
This unimplemented operation is meand to return an attribute as a nodeParameters: attrName
Returns: null, always.
See Also: org.w3c.dom.Element#getAttributeNode(String)
UNKNOWN: Fix this for SAAJ 1.2 Implementation. marked as deprecated to warn people it is broken
Deprecated: not implemented!
Parameters: namespace namespace localName local name
Returns: null
See Also: org.w3c.dom.Element#getAttributeNS(String, String)
Parameters: namespaceURI namespace localName name
Returns: string value or null if not found
See Also: org.w3c.dom.Element#getAttributeNS(String, String)
UNKNOWN: this could be refactored to use getAttributeValue()
Returns: attributes. If this equals {@link NullAttributes.singleton} it is null
Parameters: localName
Returns: the value or null
Parameters: attrName qualified name of the attribute
Returns: the attribute or null if there was no match
See Also: getAttributeValue
Parameters: qname
Returns: child element or null
See Also: getChildElements
Returns: an iterator over child elements.
See Also: getChildElements
Parameters: 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.
Returns: an iterator.
Parameters: childName 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.
Returns: an iterator.
See Also: getChildElements
Returns: a list, or null if there are no children
Returns: Attributes collection
Returns: The DeserializationContext associated with this MessageElement
Returns:
See Also: getElementName
Parameters: tagName tag to look for.
Returns: a list of elements
See Also: org.w3c.dom.Element#getElementsByTagName(String)
Parameters: namespace namespace localName local name of element
Returns: (potentially empty) list of elements that match the (namespace,localname) tuple
See Also: org.w3c.dom.Element#getElementsByTagNameNS(String, String)
Parameters: parentElement parent element namespace namespace localName local name of element
Returns: (potentially empty) list of elements that match the (namespace,localname) tuple
Returns: the currently in-scope encoding style
Returns: envelope or null.
Returns: href or null
Returns: ID or null for no ID
length-1
inclusive.Returns: number of children
Since: SAAJ 1.2 : Nodelist Interface
See Also: org.w3c.dom.NodeList#getLength()
Returns: name
Returns: an iterator over a vector of prefixes
See Also: getNamespacePrefixes
Parameters: searchPrefix
Returns: the prefix, or null for no match
Returns: Object of proper type, or null if no mapping could be found.
Parameters: cls Class that contains top level deserializer metadata
Returns: Object of proper type, or null if no mapping could be found.
Parameters: searchNamespaceURI namespace
Returns: null for null or emtpy uri, null for no match, and the prefix iff there is a match
Returns: a QName describing the name of thsi element
Returns: the message element or null if there is a href to something that is not a MessageElemeent.
Returns: recorder or null
Returns: the name of the element
See Also: org.w3c.dom.Element#getTagName()
Returns:
Returns: the value of any child node, or null if there is no node/something went wrong during serialization. If the first child is text, the return value is the text itself.
See Also: ;
Parameters: type type to look up a deserializer for. cls class to use for looking up the deserializer. This takes precedence over the type field.
Returns: the value of the deserializer
Throws: Exception
Returns: an iterator.
Parameters: attrName name of attribute (or null)
Returns: true if it exists Note that the behaviour for a null parameter (returns false) is not guaranteed in future
See Also: org.w3c.dom.Element#hasAttribute(String)
Parameters: namespace localName
Returns:
See Also: org.w3c.dom.Element#hasAttributeNS(String, String)
Returns: true if the element is considered a document root.
Parameters: index index value
Returns: child or null for out of range value
See Also: org.w3c.dom.NodeList#item(int)
Parameters: outputContext the SerializationContext we will write to.
Parameters: outputContext destination.
Throws: Exception if something went wrong.
Parameters: handler
Throws: SAXException
Parameters: handler
Throws: SAXException
Parameters: attrName name of the element
Returns: true if the attribute was found and removed.
See Also: removeAttribute
Parameters: attrName name of the attributes
Throws: DOMException
See Also: org.w3c.dom.Element#removeAttribute(String)
Parameters: oldAttr
Returns: oldAttr
Throws: DOMException
Parameters: namespace namespace of attr localName local name
Throws: DOMException
See Also: org.w3c.dom.Element#removeAttributeNS(String, String)
Parameters: namespacePrefix
Returns: true if the prefix was found and removed.
See Also: removeNamespaceDeclaration
Parameters: attrs a new attributes list
Parameters: name attribute name value attribute value
Throws: DOMException
See Also: org.w3c.dom.Element#setAttribute(String, String)
Deprecated: this is not implemented
set the attribute node.Parameters: newAttr
Returns: newAttr
Throws: DOMException
See Also: org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr)
UNKNOWN: implement
Parameters: newAttr
Returns: null
Throws: DOMException
See Also: org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr)
UNKNOWN: implement properly.
Parameters: namespaceURI namepsace qualifiedName qualified name of the attribue value value
Throws: DOMException
See Also: org.w3c.dom.Element#setAttributeNS(String, String, String)
Parameters: index index value of the first event of our recorder.
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 "".
Parameters: encodingStyle a String
giving the encoding style
Throws: java.lang.IllegalArgumentException if there was a problem in the encoding style being set.
See Also: getEncodingStyle()
Parameters: endIndex end value
Parameters: env
Parameters: name
Parameters: nsURI new namespace URI
Parameters: namespaces
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.
Parameters: newValue node's value or null.
Parameters: qName qualified name
Parameters: rec
Parameters: qname
Returns: a string representing the class