org.apache.axiom.om
public interface: OMElement [javadoc |
source]
All Implemented Interfaces:
OMContainer, OMNode
All Known Implementing Classes:
SOAP11FaultReasonImpl, SOAPElement, OMElementImpl, OMSourcedElementImpl, SOAPFaultValue, SOAPFaultNodeImpl, SOAPFaultReason, SOAPFaultImpl, SOAPFaultReasonImpl, SOAP11FaultSubCodeImpl, SOAP12FaultReasonImpl, SOAPFault, SOAP12FaultTextImpl, SOAP11HeaderBlockImpl, SOAP12FaultCodeImpl, SOAPFaultNode, SOAPHeader, SOAP11FaultImpl, SOAPFaultRoleImpl, SOAP12FaultValueImpl, SOAPFaultText, SOAPFaultDetailImpl, SOAP12FaultNodeImpl, SOAPFaultNodeImpl, SOAP11FaultReasonImpl, SOAP11FaultCodeImpl, SOAPBody, SOAPFaultTextImpl, SOAPFaultRoleImpl, SOAPFaultSubCodeImpl, SOAPBodyImpl, SOAP11HeaderImpl, SOAPElement, SOAP12FaultDetailImpl, SOAP12FaultCodeImpl, SOAP12FaultNodeImpl, SOAP12FaultDetailImpl, SOAPFaultImpl, SOAP12HeaderBlockImpl, SOAP12FaultTextImpl, SOAPFaultCodeImpl, SOAP11FaultRoleImpl, OMSourcedElement, SOAP11FaultTextImpl, SOAP12HeaderImpl, SOAP12FaultSubCodeImpl, SOAP12FaultSubCodeImpl, SOAPEnvelopeImpl, SOAPHeaderBlockImpl, SOAP11FaultDetailImpl, SOAPFaultSubCode, SOAPHeaderImpl, SOAPHeaderImpl, SOAPTextImpl, SOAPFaultReasonImpl, SOAPEnvelopeImpl, SOAPFaultRole, SOAP12BodyImpl, SOAPFaultValueImpl, SOAPEnvelope, SOAP11FaultTextImpl, SOAPFaultSubCodeImpl, SOAP11FaultValueImpl, SOAP12FaultValueImpl, SOAPHeaderBlockImpl, SOAP11FaultValueImpl, SOAP12FaultReasonImpl, SOAP11BodyImpl, SOAP12HeaderBlockImpl, ElementImpl, SOAPFaultDetail, SOAP11FaultSubCodeImpl, SOAP11BodyImpl, SOAP12BodyImpl, SOAP11HeaderImpl, SOAP11HeaderBlockImpl, SOAPFaultTextImpl, SOAP12FaultImpl, SOAPFaultCodeImpl, SOAPHeaderBlock, SOAP12FaultImpl, SOAP11FaultCodeImpl, SOAPFaultDetailImpl, SOAP11FaultImpl, SOAPFaultValueImpl, SOAPTextImpl, SOAP11FaultDetailImpl, SOAP12HeaderImpl, SOAP12FaultRoleImpl, SOAP12FaultRoleImpl, SOAP11FaultRoleImpl, SOAPBodyImpl, SOAPFaultCode
A particular kind of node that represents an element infoset information item.
An element has a collection of children, attributes, and namespaces.
In contrast with
DOM, this interface exposes namespaces separately from the attributes.
| Method from org.apache.axiom.om.OMElement Summary: |
|---|
|
addAttribute, addAttribute, cloneOMElement, declareDefaultNamespace, declareNamespace, declareNamespace, findNamespace, findNamespaceURI, getAllAttributes, getAllDeclaredNamespaces, getAttribute, getAttributeValue, getBuilder, getChildElements, getDefaultNamespace, getFirstElement, getLineNumber, getLocalName, getNamespace, getQName, getText, getTextAsQName, getXMLStreamReader, getXMLStreamReaderWithoutCaching, removeAttribute, resolveQName, setBuilder, setFirstChild, setLineNumber, setLocalName, setNamespace, setNamespaceWithNoFindInCurrentScope, setText, setText, toString, toStringWithConsume |
| Method from org.apache.axiom.om.OMElement Detail: |
public OMAttribute addAttribute(OMAttribute attr)
|
public OMAttribute addAttribute(String attributeName,
String value,
OMNamespace ns)
Adds an attribute to the current element.
This function does not check to make sure that the given attribute value can be serialized
directly as an XML value. The caller may, for example, pass a string with the character
0x01. |
public OMElement cloneOMElement()
Clones this element. Since both elements are build compleletely, you will lose the differed
building capability. |
public OMNamespace declareDefaultNamespace(String uri)
This will declare a default namespace for this element explicitly |
public OMNamespace declareNamespace(OMNamespace namespace)
Declares a namespace with the element as its scope. |
public OMNamespace declareNamespace(String uri,
String prefix)
Creates a namespace in the current element scope. |
public OMNamespace findNamespace(String uri,
String prefix)
Finds a namespace with the given uri and prefix, in the scope of the hierarchy.
Searches from the current element and goes up the hiararchy until a match is found. If no
match is found, returns null.
Either prefix or uri should be null. Results are undefined if both are
specified. |
public OMNamespace findNamespaceURI(String prefix)
Checks for a namespace in the context of this element with the given prefix and returns the
relevant namespace object, if available. If not available, returns null. |
public Iterator getAllAttributes()
|
public Iterator getAllDeclaredNamespaces() throws OMException
Returns an iterator for all of the namespaces declared on this element.
If you're interested in all namespaces in scope, you need to call this function for all
parent elements as well. Note that the iterator may be invalidated by any call to either
declareNamespace function. |
public OMAttribute getAttribute(QName qname)
Returns a named attribute if present. |
public String getAttributeValue(QName qname)
Returns a named attribute's value, if present. |
public OMXMLParserWrapper getBuilder()
Returns the builder object. |
public Iterator getChildElements()
Returns a filtered list of children - just the elements. |
public OMNamespace getDefaultNamespace()
This will retrieve the default namespace of this element, if available. null returned if none
is found. |
public OMElement getFirstElement()
Returns the first child element of the element. |
public int getLineNumber()
|
public String getLocalName()
Returns the local name of the element. |
public OMNamespace getNamespace() throws OMException
|
public QName getQName()
Gets the QName of this node. |
public String getText()
Returns the non-empty text children as a string.
This method iterates over all the text children of the element and concatenates
them to a single string. Only direct children will be considered, i.e. the text
is not extracted recursively. For example the return value for
<element>A<child>B</child>C</element> will be AC.
All whitespace will be preserved. |
public QName getTextAsQName()
OMText can contain its information as a QName as well. This will return the text as a QName |
public XMLStreamReader getXMLStreamReader()
Returns the pull parser that will generate the pull events relevant to THIS element.
Caching is on. |
public XMLStreamReader getXMLStreamReaderWithoutCaching()
Returns the pull parser that will generate the pull events relevant to THIS element.
Caching is off. |
public void removeAttribute(OMAttribute attr)
|
public QName resolveQName(String qname)
Turns a prefix:local qname string into a proper QName, evaluating it in the OMElement
context. Unprefixed qnames resolve to the local namespace. |
public void setBuilder(OMXMLParserWrapper wrapper)
|
public void setFirstChild(OMNode node)Deprecated! This - method should not be called, un-intentionally. When some one randomly set
the first child, all the links handling will not happen inside this method. So we
have moved this method to the less visible interface, OMContainerEx.
|
public void setLineNumber(int lineNumber)
|
public void setLocalName(String localName)
|
public void setNamespace(OMNamespace namespace)
Sets the Namespace. This will first search for a namespace in the current scope with the
given namespace. If no namespace is found with the given details, then it will declare a new
one. Then that namespace will be assigned to this element. |
public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace)
This will not search the namespace in the scope nor will declare in the current element, as
in setNamespace(OMNamespace). This will just assign the given namespace to the element. |
public void setText(String text)
|
public void setText(QName text)
|
public String toString()
This is a convenience method only. This will basically serialize the given OMElement to a
String but will build the OMTree in the memory |
public String toStringWithConsume() throws XMLStreamException
This is a convenience method only. This basically serializes the given OMElement to a String
but will NOT build the OMTree in the memory. So you are at your own risk of losing
information. |