public interface XmlWriter
Modifier and Type | Method and Description |
---|---|
void |
addOptionalTextAttribute(java.lang.String name,
java.lang.String value)
Add optional no-namespace text attribute to current open start tag.
|
void |
addOptionalTextAttribute(java.lang.String ns,
java.lang.String name,
java.lang.String value)
Add optional text attribute to current open start tag.
|
void |
addText(java.lang.String value)
Write a text value as the content of the current element.
|
void |
addTextAttribute(java.lang.String name,
java.lang.String value)
Add no-namespace text attribute to current open start tag.
|
void |
addTextAttribute(java.lang.String ns,
java.lang.String name,
java.lang.String value)
Add text attribute to current open start tag.
|
void |
close()
Close document output.
|
void |
convert(java.math.BigDecimal value)
Write a
BigDecimal value to the current text selection. |
void |
convert(java.math.BigInteger value)
Write a
BigInteger value to the current text selection. |
void |
convert(boolean value)
Write a
boolean value to the current text selection. |
void |
convert(byte[] value)
Write a
byte[] value to the current text selection using base64Binary encoding. |
void |
convert(double value)
Write a
double value to the current text selection. |
void |
convert(float value)
Write a
float value to the current text selection. |
void |
convert(int value)
Write an
int value to the current text selection. |
void |
convert(long value)
Write a
long value to the current text selection. |
void |
convert(java.lang.String value)
Write a
String value to the current text selection. |
void |
convertDate(long value)
Write a
long milliseconds time value to the current text selection as an xsd:date. |
void |
convertDateTime(long value)
Write a
long milliseconds time value to the current text selection as an xsd:dateTime. |
void |
convertDateTime(long value,
int nanos)
Write a
long milliseconds time value and associated nanosecond count to the current text selection
as an xsd:dateTime. |
void |
convertQName(java.lang.String ns,
java.lang.String name)
Write a qualified name value to the current text selection.
|
void |
convertTime(long value)
Write a
long milliseconds time value to the current text selection as an xsd:time. |
void |
convertTime(long value,
int nanos)
Write a
long milliseconds time value and associated nanosecond count to the current text selection
as an xsd:time. |
void |
endTag()
Write end tag for current open element.
|
void |
flush()
Flush document output.
|
MarshallingContext |
getContext()
Get the marshalling context associated with this writer.
|
java.lang.String[][] |
getExtensionNamespaces()
Get extension namespace URIs added to those in mapping.
|
int |
getNamespaceCount()
Get the number of namespaces currently defined.
|
java.lang.String |
getNamespacePrefix(int index)
Get current prefix defined for namespace.
|
java.lang.String[] |
getNamespaces()
Get namespace URIs for mapping.
|
java.lang.String |
getNamespaceUri(int index)
Get URI for namespace.
|
int |
getNestingDepth()
Get the current element nesting depth.
|
int |
getPrefixIndex(java.lang.String prefix)
Get index of namespace mapped to prefix.
|
ValidationContext |
getValidationContext()
Get the current validation context for this writer.
|
void |
handleMissingAttribute(java.lang.String name)
Handle a missing required attribute value from the implicit namespace in the generated document.
|
void |
handleMissingAttribute(java.lang.String ns,
java.lang.String name)
Handle a missing required attribute value in the generated document.
|
void |
handleMissingElement(java.lang.String name)
Handle a missing required element value from the implicit namespace in the generated document.
|
void |
handleMissingElement(java.lang.String ns,
java.lang.String name)
Handle a missing required element value in the generated document.
|
void |
indent()
Request output indent.
|
void |
openNamespace(java.lang.String ns,
java.lang.String prefix)
Add a namespace declaration to the next element start tag.
|
int[] |
openNamespaces(int[] nums,
java.lang.String[] prefs)
Open the specified namespaces for use.
|
void |
popExtensionNamespaces()
Remove extension namespace URIs.
|
void |
pushExtensionNamespaces(java.lang.String[] uris)
Append extension namespace URIs to those in mapping.
|
void |
reset()
Reset to initial state for reuse.
|
void |
selectAttribute(java.lang.String name)
Select a no-namespace attribute as the destination for a conversion.
|
void |
selectAttribute(java.lang.String ns,
java.lang.String name)
Select an attribute as the destination for a conversion.
|
void |
selectContent()
Select text content as the destination for a conversion.
|
void |
selectContent(java.lang.String name)
Select a child element in the implicit namespace as the destination for a conversion.
|
void |
selectContent(java.lang.String ns,
java.lang.String name)
Select a child element as the destination for a conversion.
|
void |
setAttributeDoubleQuote(boolean prefdbl)
Set attribute double-quote character usage.
|
void |
setBooleanNumeric(boolean prefnum)
Set boolean numeric value usage.
|
java.lang.String |
setImplicitNamespace(java.lang.String ns)
Set the implicit namespace used for elements unless otherwise specified.
|
void |
setIndent(int count,
java.lang.String newline,
char indent)
Set nesting indentation.
|
void |
startTag(java.lang.String name)
Write the start tag for an element in the implicit namespace.
|
void |
startTag(java.lang.String ns,
java.lang.String name)
Write the start tag for an element.
|
void |
startTagImplicit(java.lang.String ns,
java.lang.String prefix,
java.lang.String name)
Declare a namespace, make it the implicit namespace, and write the start tag for an element in that namespace.
|
void |
writeCData(java.lang.String text)
Write CDATA text to document.
|
void |
writeComment(java.lang.String text)
Write comment to document.
|
void |
writeDocType(java.lang.String name,
java.lang.String sys,
java.lang.String pub,
java.lang.String subset)
Write DOCTYPE declaration to document.
|
void |
writeEntityRef(java.lang.String name)
Write entity reference to document.
|
void |
writePI(java.lang.String target,
java.lang.String data)
Write processing instruction to document.
|
void |
writeTextContent(java.lang.String text)
Write ordinary character data text content to document.
|
void |
writeXMLDecl(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone)
Write XML declaration to document.
|
MarshallingContext getContext()
ValidationContext getValidationContext()
int getNestingDepth()
int getNamespaceCount()
void setIndent(int count, java.lang.String newline, char indent)
count
- number of character to indent per level, or disable indentation if negative (zero means new line
only)newline
- sequence of characters used for a line ending (null
means use the single character
'\n')indent
- whitespace character used for indentationvoid setAttributeDoubleQuote(boolean prefdbl)
true
, the double-quote (") character is
preferred for attribute values; if false
(the default), the single-quote (') character is preferred.
This setting is advisory only, and implementations of this interface are free to ignore it.prefdbl
- prefer double-quote flagvoid setBooleanNumeric(boolean prefnum)
true
, numeric values ('0' and '1') are preferred for
boolean values; if false
(the default), text values ('false' and 'true') are preferred. This setting
is advisory only, and implementations of this interface are free to ignore it.prefnum
- prefer numeric boolean value flagjava.lang.String setImplicitNamespace(java.lang.String ns)
ns
- namespace URI for element (may be the empty string for the no-namespace namespace)void startTag(java.lang.String name) throws JiBXException
name
- element nameJiBXException
- on unrecoverable errorvoid startTag(java.lang.String ns, java.lang.String name) throws JiBXException
ns
- namespace URI for element (may be the empty string for the no-namespace namespace)name
- unqualified element nameJiBXException
- on unrecoverable errorvoid startTagImplicit(java.lang.String ns, java.lang.String prefix, java.lang.String name) throws JiBXException
openNamespace(String, String)
, setImplicitNamespace(String)
, startTag(String)
.ns
- namespace URI for element (may be the empty string for the no-namespace namespace)prefix
- prefix to be used for the namespace (use "" for default namespace declaration)name
- unqualified element nameJiBXException
- on unrecoverable errorvoid openNamespace(java.lang.String ns, java.lang.String prefix) throws JiBXException
ns
- namespace URI (may be the empty string for the no-namespace namespace)prefix
- prefix to be used for the namespace (use "" for default namespace declaration)JiBXException
- on unrecoverable errorvoid addTextAttribute(java.lang.String name, java.lang.String value) throws JiBXException
name
- unqualified attribute namevalue
- text value for attributeJiBXException
- on unrecoverable errorvoid addTextAttribute(java.lang.String ns, java.lang.String name, java.lang.String value) throws JiBXException
ns
- namespace URI (may be the empty string for the no-namespace namespace)name
- unqualified attribute namevalue
- text value for attributeJiBXException
- on unrecoverable errorvoid addOptionalTextAttribute(java.lang.String name, java.lang.String value) throws JiBXException
name
- unqualified attribute namevalue
- text value for attribute (null
if no value)JiBXException
- on unrecoverable errorvoid addOptionalTextAttribute(java.lang.String ns, java.lang.String name, java.lang.String value) throws JiBXException
ns
- namespace URI (may be the empty string for the no-namespace namespace)name
- unqualified attribute namevalue
- text value for attribute (null
if no value)JiBXException
- on unrecoverable errorvoid selectContent() throws JiBXException
JiBXException
- on unrecoverable errorvoid selectContent(java.lang.String name) throws JiBXException
name
- element nameJiBXException
- on unrecoverable errorvoid selectContent(java.lang.String ns, java.lang.String name) throws JiBXException
ns
- namespace URI (may be the empty string for the no-namespace namespace)name
- element nameJiBXException
- on unrecoverable errorvoid selectAttribute(java.lang.String name) throws JiBXException
name
- unqualified attribute nameJiBXException
- on unrecoverable errorvoid selectAttribute(java.lang.String ns, java.lang.String name) throws JiBXException
ns
- namespace URI (may be the empty string for the no-namespace namespace)name
- unqualified attribute nameJiBXException
- on unrecoverable errorvoid convert(java.lang.String value) throws JiBXException
String
value to the current text selection.value
- JiBXException
- on unrecoverable errorvoid convert(int value) throws JiBXException
int
value to the current text selection.value
- JiBXException
- on unrecoverable errorvoid convert(long value) throws JiBXException
long
value to the current text selection.value
- JiBXException
- on unrecoverable errorvoid convert(float value) throws JiBXException
float
value to the current text selection.value
- JiBXException
- on unrecoverable errorvoid convert(double value) throws JiBXException
double
value to the current text selection.value
- JiBXException
- on unrecoverable errorvoid convert(boolean value) throws JiBXException
boolean
value to the current text selection.value
- JiBXException
- on unrecoverable errorvoid convert(byte[] value) throws JiBXException
byte[]
value to the current text selection using base64Binary encoding.value
- attribute valueJiBXException
- on unrecoverable errorvoid convertDateTime(long value) throws JiBXException
long
milliseconds time value to the current text selection as an xsd:dateTime.value
- JiBXException
- on unrecoverable errorvoid convertDateTime(long value, int nanos) throws JiBXException
long
milliseconds time value and associated nanosecond count to the current text selection
as an xsd:dateTime.value
- nanos
- JiBXException
- on unrecoverable errorvoid convertDate(long value) throws JiBXException
long
milliseconds time value to the current text selection as an xsd:date.value
- JiBXException
- on unrecoverable errorvoid convertTime(long value) throws JiBXException
long
milliseconds time value to the current text selection as an xsd:time.value
- JiBXException
- on unrecoverable errorvoid convertTime(long value, int nanos) throws JiBXException
long
milliseconds time value and associated nanosecond count to the current text selection
as an xsd:time.value
- nanos
- JiBXException
- on unrecoverable errorvoid convertQName(java.lang.String ns, java.lang.String name) throws JiBXException
ns
- namespace URI (empty string if no-namespace namespace)name
- local nameJiBXException
- on unrecoverable errorvoid convert(java.math.BigDecimal value) throws JiBXException
BigDecimal
value to the current text selection.value
- (non-null
)JiBXException
- on unrecoverable errorvoid convert(java.math.BigInteger value) throws JiBXException
BigInteger
value to the current text selection.value
- (non-null
)JiBXException
- on unrecoverable errorvoid addText(java.lang.String value) throws JiBXException
value
- content valueJiBXException
- on unrecoverable errorvoid endTag() throws JiBXException
JiBXException
- on unrecoverable errorvoid handleMissingElement(java.lang.String name) throws JiBXException
name
- JiBXException
- on unrecoverable errorvoid handleMissingElement(java.lang.String ns, java.lang.String name) throws JiBXException
ns
- name
- JiBXException
- on unrecoverable errorvoid handleMissingAttribute(java.lang.String name) throws JiBXException
name
- JiBXException
- on unrecoverable errorvoid handleMissingAttribute(java.lang.String ns, java.lang.String name) throws JiBXException
ns
- name
- JiBXException
- on unrecoverable errorvoid writeXMLDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone) throws JiBXException
version
- XML version textencoding
- text for encoding attribute (unspecified if null
)standalone
- text for standalone attribute (unspecified if null
)JiBXException
- on error writing to documentvoid writeTextContent(java.lang.String text) throws JiBXException
text
- content value text (must not be null
)JiBXException
- on error writing to documentvoid writeCData(java.lang.String text) throws JiBXException
text
- content value text (must not be null
)JiBXException
- on error writing to documentvoid writeComment(java.lang.String text) throws JiBXException
text
- comment text (must not be null
)JiBXException
- on error writing to documentvoid writeEntityRef(java.lang.String name) throws JiBXException
name
- entity name (must not be null
)JiBXException
- on error writing to documentvoid writeDocType(java.lang.String name, java.lang.String sys, java.lang.String pub, java.lang.String subset) throws JiBXException
name
- root element namesys
- system ID (null
if none, must be non-null
for ID to be used)pub
- ID (null
if none)subset
- internal subset (null
if none)JiBXException
- on error writing to documentvoid writePI(java.lang.String target, java.lang.String data) throws JiBXException
target
- processing instruction target name (must not be null
)data
- processing instruction data (must not be null
)JiBXException
- on error writing to documentvoid indent() throws JiBXException
JiBXException
- on error writing to documentvoid flush() throws JiBXException
JiBXException
- on error writing to documentvoid close() throws JiBXException
JiBXException
- on error writing to documentvoid reset()
java.lang.String[] getNamespaces()
java.lang.String getNamespaceUri(int index)
index
- namespace URI index numbernull
if the namespace index is invalidjava.lang.String getNamespacePrefix(int index)
index
- namespace URI index numbernull
if the namespace is not currently mappedint getPrefixIndex(java.lang.String prefix)
prefix
- text to match (non-null
, use "" for default prefix)void pushExtensionNamespaces(java.lang.String[] uris)
uris
- namespace URIs to extend those in mappingvoid popExtensionNamespaces()
pushExtensionNamespaces(java.lang.String[])
.java.lang.String[][] getExtensionNamespaces()
null
if none)int[] openNamespaces(int[] nums, java.lang.String[] prefs) throws JiBXException
nums
- array of namespace indexes defined by this element (must be constant, reference is kept until
namespaces are closed)prefs
- array of namespace prefixes mapped by this element (no null
values, use "" for
default namespace declaration)JiBXException
- on error writing to document