|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.runtime.impl.XMLWriterNamespaceBase
org.jibx.runtime.impl.XMLWriterBase
public abstract class XMLWriterBase
Base implementation of XML writer interface. This provides common handling of indentation and formatting that can be used for all forms of text output.
Field Summary | |
---|---|
private boolean |
m_afterFirst
Flag for first write done (used to skip indentation before first element). |
private boolean |
m_contentSeen
Flag for current element has content. |
private boolean |
m_textSeen
Flag for current element has text content. |
Fields inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase |
---|
m_prefixes, m_uris |
Constructor Summary | |
---|---|
XMLWriterBase(java.lang.String[] uris)
Constructor. |
|
XMLWriterBase(XMLWriterBase base,
java.lang.String[] uris)
Copy constructor. |
Method Summary | |
---|---|
void |
addAttribute(int index,
java.lang.String name,
java.lang.String value)
Add attribute to current open start tag. |
abstract 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. |
protected void |
flagContent()
Set up for writing any content to element. |
protected void |
flagTextContent()
Set up for writing text content to element. |
abstract void |
flush()
Flush document output. |
protected abstract void |
indent(int bias)
Request output indent with bias from current element nesting level. |
private void |
indentAfterFirst()
Conditionally indent output only if not the first write. |
void |
init()
Initialize writer. |
void |
reset()
Reset to initial state for reuse. |
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. |
protected abstract void |
writeAttributeText(java.lang.String text)
Write attribute text to output. |
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. |
protected abstract void |
writeMarkup(char chr)
Write markup character to output. |
protected abstract void |
writeMarkup(java.lang.String text)
Write markup text to output. |
void |
writePI(java.lang.String target,
java.lang.String data)
Write processing instruction to document. |
protected abstract void |
writePrefix(int index)
Write namespace prefix to output. |
void |
writeXMLDecl(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone)
Write XML declaration to document. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jibx.runtime.IExtensibleWriter |
---|
createChildWriter |
Methods inherited from interface org.jibx.runtime.IXMLWriter |
---|
getExtensionNamespaces, getNamespaceCount, getNamespacePrefix, getNamespaces, getNamespaceUri, getNestingDepth, getPrefixIndex, indent, openNamespaces, popExtensionNamespaces, popTranslationTable, pushExtensionNamespaces, pushTranslationTable, setIndentSpaces, writeCData, writeTextContent |
Field Detail |
---|
private boolean m_textSeen
private boolean m_contentSeen
private boolean m_afterFirst
Constructor Detail |
---|
public XMLWriterBase(java.lang.String[] uris)
uris
- ordered array of URIs for namespaces used in document (must
be constant; the value in position 0 must always be the empty string "",
and the value in position 1 must always be the XML namespace
"http://www.w3.org/XML/1998/namespace")public XMLWriterBase(XMLWriterBase base, java.lang.String[] uris)
base
- existing instanceuris
- ordered array of URIs for namespaces used in documentMethod Detail |
---|
protected abstract void writeMarkup(java.lang.String text) throws java.io.IOException
text
- markup text to be written
java.io.IOException
- if error writing to documentprotected abstract void writeMarkup(char chr) throws java.io.IOException
chr
- markup character to be written
java.io.IOException
- if error writing to documentprotected abstract void writePrefix(int index) throws java.io.IOException
index
- namespace URI index number
java.io.IOException
- if error writing to documentprotected abstract void writeAttributeText(java.lang.String text) throws java.io.IOException
text
- attribute value text to be written
java.io.IOException
- if error writing to documentprotected abstract void indent(int bias) throws java.io.IOException
java.io.IOException
- on error writing to documentprotected final void flagContent() throws java.io.IOException
java.io.IOException
- on error writing to documentprotected final void flagTextContent() throws java.io.IOException
java.io.IOException
- on error writing to documentpublic void init()
init
in interface IXMLWriter
public void writeXMLDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone) throws java.io.IOException
writeXMLDecl
in interface IXMLWriter
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 documentpublic void startTagOpen(int index, java.lang.String name) throws java.io.IOException
closeStartTag()
call.
startTagOpen
in interface IXMLWriter
index
- namespace URI index numbername
- unqualified element name
java.io.IOException
- on error writing to documentpublic void startTagNamespaces(int index, java.lang.String name, int[] nums, java.lang.String[] prefs) throws java.io.IOException
startTagNamespaces
in interface IXMLWriter
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 documentpublic void addAttribute(int index, java.lang.String name, java.lang.String value) throws java.io.IOException
startTagOpen(int, java.lang.String)
or startTagNamespaces(int, java.lang.String, int[], java.lang.String[])
and before the
corresponding call to closeStartTag()
.
addAttribute
in interface IXMLWriter
index
- namespace URI index numbername
- unqualified attribute namevalue
- text value for attribute
java.io.IOException
- on error writing to documentpublic void closeStartTag() throws java.io.IOException
startTagOpen(int, java.lang.String)
.
closeStartTag
in interface IXMLWriter
java.io.IOException
- on error writing to documentpublic void closeEmptyTag() throws java.io.IOException
startTagOpen(int, java.lang.String)
.
closeEmptyTag
in interface IXMLWriter
java.io.IOException
- on error writing to documentprivate void indentAfterFirst() throws java.io.IOException
java.io.IOException
- on write errorpublic void startTagClosed(int index, java.lang.String name) throws java.io.IOException
startTagClosed
in interface IXMLWriter
index
- namespace URI index numbername
- unqualified element name
java.io.IOException
- on error writing to documentpublic void endTag(int index, java.lang.String name) throws java.io.IOException
endTag
in interface IXMLWriter
index
- namespace URI index numbername
- unqualified element name
java.io.IOException
- on error writing to documentpublic void writeComment(java.lang.String text) throws java.io.IOException
writeComment
in interface IXMLWriter
text
- comment text
java.io.IOException
- on error writing to documentpublic void writeEntityRef(java.lang.String name) throws java.io.IOException
writeEntityRef
in interface IXMLWriter
name
- entity name
java.io.IOException
- on error writing to documentpublic void writeDocType(java.lang.String name, java.lang.String sys, java.lang.String pub, java.lang.String subset) throws java.io.IOException
writeDocType
in interface IXMLWriter
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 documentpublic void writePI(java.lang.String target, java.lang.String data) throws java.io.IOException
writePI
in interface IXMLWriter
target
- processing instruction target namedata
- processing instruction data
java.io.IOException
- on error writing to documentpublic abstract void flush() throws java.io.IOException
flagContent()
.
flush
in interface IXMLWriter
java.io.IOException
- on error writing to documentpublic abstract void close() throws java.io.IOException
close
in interface IXMLWriter
java.io.IOException
- on error writing to documentpublic void reset()
reset
in interface IXMLWriter
reset
in class XMLWriterNamespaceBase
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |