Class SaajStaxWriter.DeferredElement
- java.lang.Object
-
- com.sun.xml.messaging.saaj.util.stax.SaajStaxWriter.DeferredElement
-
- Enclosing class:
- SaajStaxWriter
public static class SaajStaxWriter.DeferredElement extends Object
Holds details of element that needs to be deferred in order to manage namespace assignments correctly.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 theflushTo(SOAPElement)
method does nothing (and returns the argument immediately) if the state of this object is not initialized (i.e. local name is null).- Author:
- [email protected]
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(String prefix, String ns, String ln, String value)
Adds attribute to the element.void
addNamespaceDeclaration(String prefix, String namespaceUri)
Adds namespace prefix assignment to the element.jakarta.xml.soap.SOAPElement
flushTo(jakarta.xml.soap.SOAPElement target)
Flushes state of this element to thetarget
element.boolean
isInitialized()
Is the element initialized?void
setLocalName(String localName)
Set local name of the element.void
setNamespaceUri(String namespaceUri)
Set namespace uri.void
setPrefix(String prefix)
Set prefix of the element.
-
-
-
Method Detail
-
setPrefix
public void setPrefix(String prefix)
Set prefix of the element.- Parameters:
prefix
- namespace prefix
-
setLocalName
public void setLocalName(String localName)
Set local name of the element.This method initializes the element.
- Parameters:
localName
- local namenot null
-
setNamespaceUri
public void setNamespaceUri(String namespaceUri)
Set namespace uri.- Parameters:
namespaceUri
- namespace uri
-
addNamespaceDeclaration
public void addNamespaceDeclaration(String prefix, String namespaceUri)
Adds namespace prefix assignment to the element.- Parameters:
prefix
- prefix (notnull
)namespaceUri
- namespace uri
-
addAttribute
public void addAttribute(String prefix, String ns, String ln, String value)
Adds attribute to the element.- Parameters:
prefix
- prefixns
- namespaceln
- local namevalue
- value
-
flushTo
public jakarta.xml.soap.SOAPElement flushTo(jakarta.xml.soap.SOAPElement target) throws XMLStreamException
Flushes state of this element to thetarget
element.If this element is initialized then it is added with all the namespace declarations and attributes to the
target
element 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
target
is returned immediately, nothing else is done.- Parameters:
target
- target element- Returns:
target
or new element- Throws:
XMLStreamException
- on error
-
isInitialized
public boolean isInitialized()
Is the element initialized?- Returns:
- boolean indicating whether it was initialized after last flush
-
-