public interface IXMLWriter
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(int index,
java.lang.String name,
java.lang.String value)
Add attribute to current open start tag.
|
void |
close()
Close document output.
|
void |
closeEmptyTag()
Close the current open start tag as an empty element.
|
void |
closeStartTag()
Close the current open start tag.
|
void |
endTag(int index,
java.lang.String name)
Generate end tag.
|
void |
flush()
Flush document output.
|
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.
|
void |
indent()
Request output indent.
|
void |
init()
Initialize writer.
|
int[] |
openNamespaces(int[] nums,
java.lang.String[] prefs)
Open the specified namespaces for use.
|
void |
popExtensionNamespaces()
Remove extension namespace URIs.
|
void |
popTranslationTable()
Pop a translation table used for converting namespace index numbers to
values matching the internal lookup.
|
void |
pushExtensionNamespaces(java.lang.String[] uris)
Append extension namespace URIs to those in mapping.
|
void |
pushTranslationTable(int[] table)
Push a translation table to be used for converting namespace index
numbers passed as arguments to values used for internal lookup.
|
void |
reset()
Reset to initial state for reuse.
|
void |
setIndentSpaces(int count,
java.lang.String newline,
char indent)
Set nesting indentation.
|
void |
startTagClosed(int index,
java.lang.String name)
Generate closed start tag.
|
void |
startTagNamespaces(int index,
java.lang.String name,
int[] nums,
java.lang.String[] prefs)
Generate start tag for element with namespaces.
|
void |
startTagOpen(int index,
java.lang.String name)
Generate open start tag.
|
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.
|
void init() throws java.io.IOException
java.io.IOException
int getNestingDepth()
int getNamespaceCount()
void setIndentSpaces(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 writeXMLDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone) throws java.io.IOException
version
- XML version textencoding
- text for encoding attribute (unspecified if
null
)standalone
- text for standalone attribute (unspecified if
null
)java.io.IOException
- on error writing to documentvoid startTagOpen(int index, java.lang.String name) throws java.io.IOException
closeStartTag()
call.index
- namespace URI index numbername
- unqualified element namejava.io.IOException
- on error writing to documentvoid startTagNamespaces(int index, java.lang.String name, int[] nums, java.lang.String[] prefs) throws java.io.IOException
index
- namespace URI index numbername
- element namenums
- array of namespace indexes defined by this element (must
be constant, reference is kept until end of element)prefs
- array of namespace prefixes mapped by this element (no
null
values, use "" for default namespace declaration)java.io.IOException
- on error writing to documentvoid addAttribute(int index, java.lang.String name, java.lang.String value) throws java.io.IOException
startTagOpen(int, java.lang.String)
and before the corresponding call to closeStartTag()
.index
- namespace URI index numbername
- unqualified attribute namevalue
- text value for attributejava.io.IOException
- on error writing to documentvoid closeStartTag() throws java.io.IOException
startTagOpen(int, java.lang.String)
.java.io.IOException
- on error writing to documentvoid closeEmptyTag() throws java.io.IOException
startTagOpen(int, java.lang.String)
.java.io.IOException
- on error writing to documentvoid startTagClosed(int index, java.lang.String name) throws java.io.IOException
index
- namespace URI index numbername
- unqualified element namejava.io.IOException
- on error writing to documentvoid endTag(int index, java.lang.String name) throws java.io.IOException
index
- namespace URI index numbername
- unqualified element namejava.io.IOException
- on error writing to documentvoid writeTextContent(java.lang.String text) throws java.io.IOException
text
- content value text (must not be null
)java.io.IOException
- on error writing to documentvoid writeCData(java.lang.String text) throws java.io.IOException
text
- content value text (must not be null
)java.io.IOException
- on error writing to documentvoid writeComment(java.lang.String text) throws java.io.IOException
text
- comment text (must not be null
)java.io.IOException
- on error writing to documentvoid writeEntityRef(java.lang.String name) throws java.io.IOException
name
- entity name (must not be null
)java.io.IOException
- on error writing to documentvoid writeDocType(java.lang.String name, java.lang.String sys, java.lang.String pub, java.lang.String subset) throws java.io.IOException
name
- root element namesys
- system ID (null
if none, must be
non-null
for public ID to be used)pub
- public ID (null
if none)subset
- internal subset (null
if none)java.io.IOException
- on error writing to documentvoid writePI(java.lang.String target, java.lang.String data) throws java.io.IOException
target
- processing instruction target name (must not be
null
)data
- processing instruction data (must not be null
)java.io.IOException
- on error writing to documentvoid indent() throws java.io.IOException
java.io.IOException
- on error writing to documentvoid flush() throws java.io.IOException
java.io.IOException
- on error writing to documentvoid close() throws java.io.IOException
java.io.IOException
- 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 java.io.IOException
nums
- array of namespace indexes defined by this element (reference
kept until namespaces are closed, values may be modified by this method)prefs
- array of namespace prefixes mapped by this element (no
null
values, use "" for default namespace declaration)java.io.IOException
- on error writing to documentvoid pushTranslationTable(int[] table)
table
- translation table to be used (null
if no
change)void popTranslationTable()