Class SaajStaxWriter.DeferredElement
- Enclosing class:
SaajStaxWriter
An instance of can be set with all the aspects of the element name (local name, prefix, namespace uri).
Attributes and namespace declarations (special case of attribute) can be added.
Namespace declarations are handled so that the element namespace is updated if it is implied by the namespace
declaration and the namespace was not set to non-null value previously.
The state of this object can be flushed to SOAPElement - new SOAPElement will
be added a child element; the new element will have exactly the shape as represented by the state of this
object. Note that the flushTo(SOAPElement) method does nothing
(and returns the argument immediately) if the state of this object is not initialized
(i.e. local name is null).
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String prefix, String ns, String ln, String value) Adds attribute to the element.voidaddNamespaceDeclaration(String prefix, String namespaceUri) Adds namespace prefix assignment to the element.flushTo(SOAPElement target) Flushes state of this element to thetargetelement.booleanIs the element initialized?voidsetLocalName(String localName) Set local name of the element.voidsetNamespaceUri(String namespaceUri) Set namespace uri.voidSet prefix of the element.
-
Method Details
-
setPrefix
Set prefix of the element.- Parameters:
prefix- namespace prefix
-
setLocalName
Set local name of the element.This method initializes the element.
- Parameters:
localName- local namenot null
-
setNamespaceUri
Set namespace uri.- Parameters:
namespaceUri- namespace uri
-
addNamespaceDeclaration
Adds namespace prefix assignment to the element.- Parameters:
prefix- prefix (notnull)namespaceUri- namespace uri
-
addAttribute
Adds attribute to the element.- Parameters:
prefix- prefixns- namespaceln- local namevalue- value
-
flushTo
Flushes state of this element to thetargetelement.If this element is initialized then it is added with all the namespace declarations and attributes to the
targetelement as a child. The state of this element is reset to uninitialized. The newly added element object is returned.If this element is not initialized then the
targetis returned immediately, nothing else is done.- Parameters:
target- target element- Returns:
targetor new element- Throws:
XMLStreamException- on error
-
isInitialized
public boolean isInitialized()Is the element initialized?- Returns:
- boolean indicating whether it was initialized after last flush
-