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 | Class and Description |
---|---|
(package private) static class |
SimpleOutputElement.AttrName
Simple key class used to represent two-piece (attribute) names;
first part being optional (URI), and second non-optional (local name).
|
Modifier and Type | Field and Description |
---|---|
protected java.util.HashSet<SimpleOutputElement.AttrName> |
mAttrSet
Map used to check for duplicate attribute declarations, if
feature is enabled.
|
protected java.lang.String |
mLocalName
Local name of the element.
|
protected SimpleOutputElement |
mParent
Reference to the parent element, element enclosing this element.
|
protected java.lang.String |
mPrefix
Prefix that is used for the element.
|
protected java.lang.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 | Constructor and Description |
---|---|
private |
SimpleOutputElement()
Constructor for the virtual root element
|
private |
SimpleOutputElement(SimpleOutputElement parent,
java.lang.String prefix,
java.lang.String localName,
java.lang.String uri,
BijectiveNsMap ns) |
Modifier and Type | Method and Description |
---|---|
protected void |
addToPool(SimpleOutputElement poolHead)
Method called to temporarily link this instance to a pool, to
allow reusing of instances with the same reader.
|
void |
checkAttrWrite(java.lang.String nsURI,
java.lang.String localName) |
protected SimpleOutputElement |
createChild(java.lang.String localName)
Simplest factory method, which gets called when a 1-argument
element output method is called.
|
protected SimpleOutputElement |
createChild(java.lang.String prefix,
java.lang.String localName,
java.lang.String uri)
Full factory method, used for 'normal' namespace qualified output
methods.
|
static SimpleOutputElement |
createRoot() |
java.lang.String |
getLocalName() |
javax.xml.namespace.QName |
getName() |
java.lang.String |
getNameDesc() |
java.lang.String |
getNamespaceURI() |
SimpleOutputElement |
getParent() |
java.lang.String |
getPrefix() |
boolean |
isRoot() |
private void |
relink(SimpleOutputElement parent,
java.lang.String prefix,
java.lang.String localName,
java.lang.String uri)
Method called to reuse a pooled instance.
|
protected SimpleOutputElement |
reuseAsChild(SimpleOutputElement parent,
java.lang.String localName) |
protected SimpleOutputElement |
reuseAsChild(SimpleOutputElement parent,
java.lang.String prefix,
java.lang.String localName,
java.lang.String uri) |
void |
setDefaultNsUri(java.lang.String uri) |
void |
setPrefix(java.lang.String prefix) |
protected void |
setRootNsContext(javax.xml.namespace.NamespaceContext ctxt)
Note: this method can and will only be called before outputting
the root element.
|
addPrefix, generateMapping, getDefaultNsUri, getExplicitPrefix, getNamespaceURI, getPrefix, getPrefixes, isPrefixValid, relink, throwOutputError
protected SimpleOutputElement mParent
protected java.lang.String mPrefix
protected java.lang.String mLocalName
protected java.lang.String mURI
mPrefix
maps to.
Non-final only to allow reuse.protected java.util.HashSet<SimpleOutputElement.AttrName> mAttrSet
private SimpleOutputElement()
private SimpleOutputElement(SimpleOutputElement parent, java.lang.String prefix, java.lang.String localName, java.lang.String uri, BijectiveNsMap ns)
private void relink(SimpleOutputElement parent, java.lang.String prefix, java.lang.String localName, java.lang.String uri)
public static SimpleOutputElement createRoot()
protected SimpleOutputElement createChild(java.lang.String localName)
protected SimpleOutputElement reuseAsChild(SimpleOutputElement parent, java.lang.String localName)
protected SimpleOutputElement reuseAsChild(SimpleOutputElement parent, java.lang.String prefix, java.lang.String localName, java.lang.String uri)
protected SimpleOutputElement createChild(java.lang.String prefix, java.lang.String localName, java.lang.String uri)
protected void addToPool(SimpleOutputElement poolHead)
public SimpleOutputElement getParent()
public boolean isRoot()
isRoot
in class OutputElementBase
public java.lang.String getNameDesc()
getNameDesc
in class OutputElementBase
public java.lang.String getPrefix()
public java.lang.String getLocalName()
public java.lang.String getNamespaceURI()
public javax.xml.namespace.QName getName()
public void checkAttrWrite(java.lang.String nsURI, java.lang.String localName) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public void setPrefix(java.lang.String prefix)
public void setDefaultNsUri(java.lang.String uri)
setDefaultNsUri
in class OutputElementBase
protected final void setRootNsContext(javax.xml.namespace.NamespaceContext ctxt)
setRootNsContext
in class OutputElementBase