public final class SimpleOutputElement extends OutputElementBase
One noteworthy feature of the class is that it is designed to allow "short-term recycling", ie. instances can be reused within context of a simple document output. While reuse/recycling of such lightweight object is often useless or even counter productive, here it may be worth using, due to simplicity of the scheme (basically using a very simple free-elements linked list).
| Modifier and Type | Field and Description |
|---|---|
protected String |
mLocalName
Local name of the element.
|
protected SimpleOutputElement |
mParent
Reference to the parent element, element enclosing this element.
|
protected String |
mPrefix
Prefix that is used for the element.
|
protected String |
mURI
Namespace of the element, whatever
mPrefix maps to. |
DEFAULT_XML_BINDINGS, mDefaultNsURI, mNsMapping, mNsMapShared, mRootNsContext, PREFIX_MISBOUND, PREFIX_OK, PREFIX_UNBOUND, sXmlNsPrefix, sXmlNsURI| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String nsURI,
String localName,
String prefix,
String value) |
protected void |
addToPool(SimpleOutputElement poolHead)
Method called to temporarily link this instance to a pool, to
allow reusing of instances with the same reader.
|
protected SimpleOutputElement |
createChild(String localName)
Simplest factory method, which gets called when a 1-argument
element output method is called.
|
protected SimpleOutputElement |
createChild(String prefix,
String localName,
String uri)
Full factory method, used for 'normal' namespace qualified output
methods.
|
static SimpleOutputElement |
createRoot() |
int |
findAttributeIndex(String nsURI,
String localName) |
int |
getAttributeCount() |
String |
getAttributeLocalName(int index) |
String |
getAttributeNamespace(int index) |
String |
getAttributePrefix(int index) |
String |
getAttributeType(int index) |
String |
getAttributeValue(int index) |
String |
getAttributeValue(String nsURI,
String localName) |
String |
getLocalName() |
QName |
getName() |
String |
getNameDesc() |
String |
getNamespaceURI() |
SimpleOutputElement |
getParent() |
String |
getPrefix() |
boolean |
isRoot() |
protected SimpleOutputElement |
reuseAsChild(SimpleOutputElement parent,
String localName) |
protected SimpleOutputElement |
reuseAsChild(SimpleOutputElement parent,
String prefix,
String localName,
String uri) |
void |
setDefaultNsUri(String uri) |
void |
setPrefix(String prefix) |
protected void |
setRootNsContext(NamespaceContext ctxt)
Note: this method can and will only be called before outputting
the root element.
|
int |
validateElementStartAndAttributes() |
addPrefix, generateMapping, getDefaultNsUri, getExplicitPrefix, getNamespaceURI, getPrefix, getPrefixes, isPrefixValid, relink, throwOutputErrorprotected SimpleOutputElement mParent
protected String mPrefix
protected String mLocalName
public static SimpleOutputElement createRoot()
protected SimpleOutputElement createChild(String localName)
protected SimpleOutputElement reuseAsChild(SimpleOutputElement parent, String localName)
protected SimpleOutputElement reuseAsChild(SimpleOutputElement parent, String prefix, String localName, String uri)
protected SimpleOutputElement createChild(String prefix, String localName, String uri)
protected void addToPool(SimpleOutputElement poolHead)
public SimpleOutputElement getParent()
public boolean isRoot()
isRoot in class OutputElementBasepublic String getNameDesc()
getNameDesc in class OutputElementBasepublic String getPrefix()
public String getLocalName()
public String getNamespaceURI()
public QName getName()
public void addAttribute(String nsURI, String localName, String prefix, String value) throws XMLStreamException
XMLStreamExceptionpublic void setPrefix(String prefix)
public void setDefaultNsUri(String uri)
setDefaultNsUri in class OutputElementBaseprotected final void setRootNsContext(NamespaceContext ctxt)
setRootNsContext in class OutputElementBasepublic int getAttributeCount()
public String getAttributeLocalName(int index)
public String getAttributeNamespace(int index)
public String getAttributePrefix(int index)
public String getAttributeValue(int index)
public String getAttributeType(int index)
public int validateElementStartAndAttributes()
throws XMLStreamException
XMLStreamExceptionCopyright © 2026 FasterXML. All rights reserved.