public class SMOutputElement extends SMOutputContainer
Modifier and Type | Field and Description |
---|---|
protected String |
_localName
Local name of the element, name without preceding prefix or colon
(in namespace mode).
|
protected SMNamespace |
_namespace
Namespace of this element.
|
protected int |
_outputState |
protected SMNamespace |
_parentDefaultNs
Namespace that was bound as the default namespace in the context
where this element gets output.
|
protected int |
_parentNsCount
Number of explicitly bound namespaces parent element has (or
for root elements 0).
|
protected static int |
OUTPUT_ATTRS |
protected static int |
OUTPUT_CHILDREN |
protected static int |
OUTPUT_CLOSED |
protected static int |
OUTPUT_NONE |
_context, _firstChild, _lastChild, _parent
_next
Modifier | Constructor and Description |
---|---|
protected |
SMOutputElement(SMOutputContext ctxt,
String localName,
SMNamespace ns) |
Modifier and Type | Method and Description |
---|---|
boolean |
_canOutputNewChild()
Method called to figure out if we can just output a newly added
child, without any buffering.
|
protected void |
_childReleased(SMOutputtable child)
Method called by a child, when it is released and neither is or
contains any buffered entities.
|
protected void |
_forceOutput(SMOutputContext ctxt)
Method similar to
SMOutputtable._output(org.codehaus.staxmate.out.SMOutputContext, boolean) , except that this method will
always succeed in doing the output. |
protected boolean |
_output(SMOutputContext ctxt,
boolean canClose)
Method called to request that the entity output itself; either
as much as it can without closing, or as much as it can if it is to
get closed.
|
protected void |
_throwClosedForAttrs()
Method for indicating illegal call to add attributes, when
the underlying stream state prevents addition.
|
protected void |
_throwClosedForNsDecls() |
void |
addAttribute(SMNamespace ns,
String localName,
boolean value)
Typed Access write method to use for adding attribute with
boolean value.
|
SMOutputElement |
addAttribute(SMNamespace ns,
String localName,
byte[] value)
Typed Access write method to use for adding attribute with
base64-encoded binary value using appropriate default variant
(MIME, no linefeeds)
|
void |
addAttribute(SMNamespace ns,
String localName,
int value)
Typed Access write method to use for adding attribute with
integer value.
|
void |
addAttribute(SMNamespace ns,
String localName,
long value)
Typed Access write method to use for adding attribute with
long value.
|
void |
addAttribute(SMNamespace ns,
String localName,
String value)
Method for adding an attribute to this element.
|
SMOutputElement |
addAttribute(String localName,
byte[] value)
Typed Access write method to use for adding attribute with
base64-encoded binary value using appropriate default variant
(MIME, no linefeeds)
|
void |
addAttribute(String localName,
String value)
Convenience method for attributes that do not belong to a
namespace (no prefix)
|
protected void |
doWriteEndElement() |
protected void |
doWriteStartElement() |
String |
getLocalName()
Method that can be used to get the local name of this element
|
SMNamespace |
getNamespace()
Method that can be used to get the namespace of the element.
|
void |
getPath(StringBuilder sb)
Method that can be called to get an XPath like description
of the relative location of this output node, starting from root.
|
void |
linkParent(SMOutputContainer parent,
boolean blocked) |
void |
predeclareNamespace(SMNamespace ns)
Method that can be (but never has to) called to force declaration
of given namespace for this element, if that is possible (i.e.
|
_closeAllButLastChild, _closeAndOutputChildren, _forceChildOutput, _linkNewChild, _throwClosed, _throwRelinking, _verifyNamespaceArg, addAndReleaseBuffered, addBuffered, addCData, addCData, addCharacters, addCharacters, addComment, addElement, addElement, addElementWithCharacters, addEntityRef, addProcessingInstruction, addValue, addValue, addValue, addValue, addValue, addValue, createBufferedElement, createBufferedFragment, getContext, getNamespace, getNamespace, getParent, getPath, setIndentation
_linkNext, getNext
protected static final int OUTPUT_NONE
protected static final int OUTPUT_ATTRS
protected static final int OUTPUT_CHILDREN
protected static final int OUTPUT_CLOSED
protected final String _localName
protected final SMNamespace _namespace
Note: can never be null -- event the default (empty) namespace is presented by a global shared namespace instance.
protected int _outputState
protected SMNamespace _parentDefaultNs
SMOutputContext
that handles actual namespace
binding for output.
This is either the default declared
namespace of an ancestor element, or if none exists, the default
namespace of the root (either the empty namespace, or one found
via NamespaceContext
.
Note: can never be null -- event the default (empty) namespace is presented by a global shared namespace instance.
protected int _parentNsCount
SMOutputContext
during
time element is open; needed for closing namespace scopes
appropriately.protected SMOutputElement(SMOutputContext ctxt, String localName, SMNamespace ns)
public void linkParent(SMOutputContainer parent, boolean blocked) throws XMLStreamException
XMLStreamException
public String getLocalName()
public SMNamespace getNamespace()
SMOutputContext.getEmptyNamespace()
)
is used instead.public void addAttribute(SMNamespace ns, String localName, String value) throws XMLStreamException
XMLStreamException
public final void addAttribute(String localName, String value) throws XMLStreamException
XMLStreamException
public void addAttribute(SMNamespace ns, String localName, boolean value) throws XMLStreamException
XMLStreamException
public void addAttribute(SMNamespace ns, String localName, int value) throws XMLStreamException
XMLStreamException
public void addAttribute(SMNamespace ns, String localName, long value) throws XMLStreamException
XMLStreamException
public SMOutputElement addAttribute(SMNamespace ns, String localName, byte[] value) throws XMLStreamException
XMLStreamException
public SMOutputElement addAttribute(String localName, byte[] value) throws XMLStreamException
XMLStreamException
public void predeclareNamespace(SMNamespace ns) throws XMLStreamException
Default namespace can often not be pre-declared using this method, because that would change namespace of the element itself if it has no prefix, so method is most often called for namespaces with explicit prefix.
Note: in cases where the given namespace can not be bound to preferred URI, exact behavior is undefined: two possible outcomes are that no namespace declaration is added, or that one with different prefix (but given namespace URI) is added. No error is reported at any rate.
XMLStreamException
protected void _childReleased(SMOutputtable child) throws XMLStreamException
SMOutputContainer
_childReleased
in class SMOutputContainer
child
- Child node that now neither is nor contains any buffered
nodes.XMLStreamException
protected boolean _output(SMOutputContext ctxt, boolean canClose) throws XMLStreamException
SMOutputtable
_output
in class SMOutputContainer
ctxt
- Output context to use for outputting this node (and
its contents)canClose
- If true, indicates that the node can (and should)
be fully closed if possible. This (passing true) is usually done
when a new sibling
is added after a node (element/fragment); if so, current one
should be recursively closed. If false, should only try to output
as much as can be done without forcing closures.XMLStreamException
protected void _forceOutput(SMOutputContext ctxt) throws XMLStreamException
SMOutputtable
SMOutputtable._output(org.codehaus.staxmate.out.SMOutputContext, boolean)
, except that this method will
always succeed in doing the output. Specifically, it will force all
buffered nodes to be unbuffered, and then output._forceOutput
in class SMOutputContainer
XMLStreamException
public boolean _canOutputNewChild() throws XMLStreamException
SMOutputContainer
_canOutputNewChild
in class SMOutputContainer
XMLStreamException
public void getPath(StringBuilder sb)
SMOutputContainer
getPath
in class SMOutputContainer
protected void doWriteStartElement() throws XMLStreamException
XMLStreamException
protected void doWriteEndElement() throws XMLStreamException
XMLStreamException
protected void _throwClosedForAttrs()
protected void _throwClosedForNsDecls()
Copyright © 2013 FasterXML. All Rights Reserved.