|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nu.staldal.xodus.Serializer
public abstract class Serializer
Serialize SAX2 events to its textual XML representation.
Support output to XML, XHTML, HTML and Text. Full support for XML namespaces.
The ContentHandler.startDocument()
and ContentHandler.endDocument()
method must be used.
Output properties controls the serialization process, it uses the keys in
javax.xml.transform.OutputKeys
.
The METHOD output property must be specified. It can be "xml", "xhtml", "text" or "html".
The CDATA_SECTION_ELEMENTS output property is not supported.
The ENCODING output property defaults to UTF-8 for XML and XHTML, and to ISO-8859-1 for Text and HTML.
The "html" output method does not escape non-ASCII characters in URI attribute values, as specified in the XSLT 1.0 specification.
javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING
and
javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING
can be used as processingInstruction targets to disable output escaping.
The methods specified in the Appendable
interface will
act like the characters(java.lang.CharSequence)
methods.
Illegal XML/HTML output may be created for inproper input, this class does not make effort to detect errors.
If the StreamResult
specifies a
Writer
or Appendable
, non-ASCII characters
will not be escaped. "<", ">", "&", '"' and "'" are always escaped properly.
Field Summary | |
---|---|
protected XMLCharacterEncoder |
out
|
protected OutputConfig |
outputConfig
|
protected java.lang.String |
systemId
|
Constructor Summary | |
---|---|
protected |
Serializer(javax.xml.transform.stream.StreamResult result,
OutputConfig outputConfig)
|
Method Summary | |
---|---|
abstract void |
characters(java.lang.CharSequence cs)
Alternative method for convenience and efficiency (no need to copy a String into a char[]). |
abstract void |
comment(java.lang.CharSequence cs)
Alternative method for convenience and efficiency (no need to copy a String into a char[]). |
static Serializer |
createSerializer(javax.xml.transform.stream.StreamResult result,
java.util.Properties outputProperties)
Factory method, create a new Serializer. |
protected void |
finishOutput()
Finish writing to output. |
abstract void |
ignorableWhitespace(java.lang.CharSequence cs)
Alternative method for convenience and efficiency (no need to copy a String into a char[]). |
protected void |
newline()
Write a newline. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xml.sax.ContentHandler |
---|
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping |
Methods inherited from interface org.xml.sax.ext.LexicalHandler |
---|
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity |
Methods inherited from interface org.xml.sax.DTDHandler |
---|
notationDecl, unparsedEntityDecl |
Methods inherited from interface org.xml.sax.ext.DeclHandler |
---|
attributeDecl, elementDecl, externalEntityDecl, internalEntityDecl |
Methods inherited from interface java.lang.Appendable |
---|
append, append, append |
Field Detail |
---|
protected final OutputConfig outputConfig
protected final java.lang.String systemId
protected final XMLCharacterEncoder out
Constructor Detail |
---|
protected Serializer(javax.xml.transform.stream.StreamResult result, OutputConfig outputConfig) throws java.lang.IllegalArgumentException, java.io.IOException, java.io.UnsupportedEncodingException
java.lang.IllegalArgumentException
java.io.IOException
java.io.UnsupportedEncodingException
Method Detail |
---|
public static Serializer createSerializer(javax.xml.transform.stream.StreamResult result, java.util.Properties outputProperties) throws java.lang.IllegalArgumentException, java.io.IOException, java.io.UnsupportedEncodingException
result
- specifies where to write the textual representation.outputProperties
- output properties, uses OutputKeys
java.io.UnsupportedEncodingException
- if the ENCODING output property
is invalid.
java.lang.IllegalArgumentException
- if any other output property is invalid.
java.io.IOException
- if the result is invalid.protected void finishOutput() throws java.io.IOException
OutputStream
or Writer
was provided.
java.io.IOException
protected void newline() throws java.io.IOException
java.io.IOException
public abstract void characters(java.lang.CharSequence cs) throws org.xml.sax.SAXException
cs
- a CharSequence
,
e.g. a String
.
org.xml.sax.SAXException
- declared to throw SAXException to be consistent
with ContentHandler
public abstract void ignorableWhitespace(java.lang.CharSequence cs) throws org.xml.sax.SAXException
cs
- a CharSequence
,
e.g. a String
.
org.xml.sax.SAXException
- declared to throw SAXException to be consistent
with ContentHandler
public abstract void comment(java.lang.CharSequence cs) throws org.xml.sax.SAXException
cs
- a CharSequence
,
e.g. a String
.
org.xml.sax.SAXException
- declared to throw SAXException to be consistent
with ContentHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |