|
||||||
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
org.jibx.runtime.impl.GenericXMLWriter
public class GenericXMLWriter
Generic handler for marshalling text document to a writer. This is the most general output handler since it can be used with any character encoding and and output writer.
Field Summary | |
---|---|
private ICharacterEscaper |
m_escaper
Escaper for character data content output. |
private boolean |
m_indent
Indent tags for pretty-printed text. |
private int |
m_indentBase
Base number of characters in indent sequence (end of line only). |
private int |
m_indentPerLevel
Number of extra characters in indent sequence per level of nesting. |
private char[] |
m_indentSequence
Raw text for indentation sequences. |
private java.io.Writer |
m_writer
Writer for text output. |
Fields inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase |
---|
m_prefixes, m_uris |
Constructor Summary | |
---|---|
GenericXMLWriter(GenericXMLWriter base,
java.lang.String[] uris)
Copy constructor. |
|
GenericXMLWriter(java.lang.String[] uris)
Constructor. |
Method Summary | |
---|---|
void |
close()
Close document output. |
IXMLWriter |
createChildWriter(java.lang.String[] uris)
Create a child writer instance to be used for a separate binding. |
protected void |
defineNamespace(int index,
java.lang.String prefix)
Report that namespace has been defined. |
void |
flush()
Flush document output. |
void |
indent()
Request output indent. |
void |
indent(int bias)
Request output indent. |
void |
setIndentSpaces(int count,
java.lang.String newline,
char indent)
Set nesting indentation. |
void |
setOutput(java.io.Writer outw,
ICharacterEscaper escaper)
Set output writer and escaper. |
protected void |
undefineNamespace(int index)
Report that namespace has been undefined. |
protected void |
writeAttributeText(java.lang.String text)
Write attribute text to output. |
void |
writeCData(java.lang.String text)
Write CDATA text to document. |
protected void |
writeMarkup(char chr)
Write markup character to output. |
protected void |
writeMarkup(java.lang.String text)
Write markup text to output. |
protected void |
writePrefix(int index)
Write namespace prefix to output. |
void |
writeTextContent(java.lang.String text)
Write ordinary character data text content to document. |
Methods inherited from class org.jibx.runtime.impl.XMLWriterBase |
---|
addAttribute, closeEmptyTag, closeStartTag, endTag, flagContent, flagTextContent, reset, startTagClosed, startTagNamespaces, startTagOpen, writeComment, writeDocType, writeEntityRef, writePI, writeXMLDecl |
Methods inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase |
---|
decrementNesting, getExtensionNamespaces, getNamespaceCount, getNamespacePrefix, getNamespaces, getNamespaceUri, getNestingDepth, getPrefixIndex, growArray, incrementNesting, openNamespaces, popExtensionNamespaces, pushExtensionNamespaces, shrinkArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.io.Writer m_writer
private ICharacterEscaper m_escaper
private boolean m_indent
private int m_indentBase
private int m_indentPerLevel
private char[] m_indentSequence
Constructor Detail |
---|
public GenericXMLWriter(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 GenericXMLWriter(GenericXMLWriter base, java.lang.String[] uris)
base
- instance to be used as base for writeruris
- ordered array of URIs for namespaces used in document
(see GenericXMLWriter(String[])
)Method Detail |
---|
public void setOutput(java.io.Writer outw, ICharacterEscaper escaper)
outw
- writer for document data outputescaper
- character escaper for chosen encodingpublic 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 indentationprotected void writeMarkup(java.lang.String text) throws java.io.IOException
writeMarkup
in class XMLWriterBase
text
- markup text to be written
java.io.IOException
- if error writing to documentprotected void writeMarkup(char chr) throws java.io.IOException
writeMarkup
in class XMLWriterBase
chr
- markup character to be written
java.io.IOException
- if error writing to documentprotected void defineNamespace(int index, java.lang.String prefix)
defineNamespace
in class XMLWriterNamespaceBase
index
- namespace URI index numberprefix
- prefix used for namespaceprotected void undefineNamespace(int index)
undefineNamespace
in class XMLWriterNamespaceBase
index
- namespace URI index numberprotected void writePrefix(int index) throws java.io.IOException
writePrefix
in class XMLWriterBase
index
- namespace URI index number
java.io.IOException
- if error writing to documentprotected void writeAttributeText(java.lang.String text) throws java.io.IOException
writeAttributeText
in class XMLWriterBase
text
- attribute value text to be written
java.io.IOException
- if error writing to documentpublic void writeTextContent(java.lang.String text) throws java.io.IOException
text
- content value text
java.io.IOException
- on error writing to documentpublic void writeCData(java.lang.String text) throws java.io.IOException
text
- content value text
java.io.IOException
- on error writing to documentpublic void indent(int bias) throws java.io.IOException
indent
in class XMLWriterBase
bias
- indent depth difference (positive or negative) from current
element nesting depth
java.io.IOException
- on error writing to documentpublic void indent() throws java.io.IOException
java.io.IOException
- on error writing to documentpublic void flush() throws java.io.IOException
flush
in interface IXMLWriter
flush
in class XMLWriterBase
java.io.IOException
- on error writing to documentpublic void close() throws java.io.IOException
close
in interface IXMLWriter
close
in class XMLWriterBase
java.io.IOException
- on error writing to documentpublic IXMLWriter createChildWriter(java.lang.String[] uris)
createChildWriter
in class XMLWriterBase
uris
- ordered array of URIs for namespaces used in document
(see GenericXMLWriter(String[])
)
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |