|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.XMLFilterImpl | +--org.xquark.util.DefaultXMLFilter | +--org.xquark.serialize.BasicXMLSerializer
A simple SAX2 XML serializer implementing SAX ContentHandler and
LexicalHandler.
IMPORTANT : Contrary to XMLSerializer
,
SAX2 XMLReader http://xml.org/sax/features/namespaces
and
http://xml.org/sax/features/namespace-prefixes
features must
be set to true for this serializer to work properly.
Constructor Summary | |
BasicXMLSerializer(java.io.OutputStream out)
Creates new BasicXMLSerializer |
|
BasicXMLSerializer(java.io.OutputStream out,
java.lang.String encoding)
Creates new BasicXMLSerializer |
|
BasicXMLSerializer(java.io.Writer out)
Creates new BasicXMLSerializer |
|
BasicXMLSerializer(java.io.Writer out,
java.lang.String encoding)
Creates new BasicXMLSerializer |
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
|
void |
close()
Closes the user stream. |
void |
comment(char[] ch,
int start,
int length)
|
void |
completeStartTag()
|
void |
endCDATA()
|
void |
endDocument()
|
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
|
void |
flush()
Flushes the user stream. |
boolean |
getAutoStreamClose()
Return the value set for stream automatic close feature. |
boolean |
getCanonicalOutput()
Accessor to the current ordering mode for attributes. |
java.lang.String |
getDefaultEncoding()
|
boolean |
getGenerateXMLDeclaration()
Accessor to the current flag for XML declaration generation. |
boolean |
getIndent()
|
boolean |
getUseIgnorableWhitespaces()
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
|
void |
reset()
Reset internal state before reuse. |
void |
setAutoStreamClose(boolean close)
Enable automatic close of the output user stream on endDocument() event. |
void |
setCanonicalOutput(boolean mode)
Set the ordering mode for attributes. |
void |
setDefaultEncoding(java.lang.String encoding)
Set the character encoding. |
void |
setGenerateEncodingDeclaration(boolean enable)
Enable encoding attribute generation in XML declaration on startDocument() event. |
void |
setGenerateXMLDeclaration(boolean enable)
Enable XML declaration generation on startDocument() event. |
void |
setIndent(boolean indent)
Set the indenting mode. |
void |
setOutputStream(java.io.OutputStream out)
Set the OutputStream where the serializer writes bytes. |
void |
setUseIgnorableWhitespaces(boolean use)
Turn on or off the use of ignorable whitespace for indentation. |
void |
setWriter(java.io.Writer out)
Set the Writer where the serializer writes characters. |
void |
startCDATA()
|
void |
startDocument()
|
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
|
Methods inherited from class org.xquark.util.DefaultXMLFilter |
endDTD, endEntity, getLexicalHandler, getProperty, setLexicalHandler, setProperty, startDTD, startEntity |
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, notationDecl, parse, parse, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BasicXMLSerializer(java.io.OutputStream out) throws java.io.UnsupportedEncodingException
out
- the OutputStream where the serializer writes bytes. For
instance a FileOutputStream.public BasicXMLSerializer(java.io.Writer out)
out
- the writer where the serializer writes characters. For
instance a FileOutputStream.public BasicXMLSerializer(java.io.OutputStream out, java.lang.String encoding) throws java.io.UnsupportedEncodingException
out
- the writer where the serializer writes characters. For
instance a FileOutputStream.encoding
- a string for the MIME encoding (must be supported by the JDK
used)OutputStream
public BasicXMLSerializer(java.io.Writer out, java.lang.String encoding)
out
- the OutputStream where the serializer writes bytes. For
instance a FileOutputStream.encoding
- a string for the MIME encoding (must be compatible with the
encoding used by the writer)Method Detail |
public void setOutputStream(java.io.OutputStream out) throws java.io.UnsupportedEncodingException
out
- the OutputStream where the serializer writes bytes. For
instance a FileOutputStream.
java.io.UnsupportedEncodingException
public void setWriter(java.io.Writer out)
out
- the writer where the serializer writes characters. For
instance a FileOutputStream.public void setIndent(boolean indent)
indent
- if true, tabs are used at the beginning of lines to indent the
output file.public void setUseIgnorableWhitespaces(boolean use)
use
- if true (the default), ignorable whitespace are used for
indentation unless automatic indentation is on.public void setCanonicalOutput(boolean mode)
mode
- If true, ordering is performed following the
Canonical XML
W3C recommendation. If false, attributes are serialized as
passed by the SAX2 XMLReader.public void setDefaultEncoding(java.lang.String encoding)
encoding
- a string specifying the character encoding, which must be
supported by the JDK. Example: UTF-8, ISO-8859-1public void setGenerateXMLDeclaration(boolean enable)
enable
- XML Declaration is generated if true. Default is true.public void setGenerateEncodingDeclaration(boolean enable)
enable
- encoding declaration generation if true. Default is true.public void setAutoStreamClose(boolean close)
close
- Output stream will be closed if true. Default is false.public boolean getIndent()
public boolean getUseIgnorableWhitespaces()
public boolean getCanonicalOutput()
public java.lang.String getDefaultEncoding()
public boolean getGenerateXMLDeclaration()
public boolean getAutoStreamClose()
setAutoStreamClose(boolean).
public void reset()
public void close()
public void flush()
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ignorableWhitespace
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
public void completeStartTag()
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
startCDATA
in class org.xquark.util.DefaultXMLFilter
org.xml.sax.SAXException
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
endCDATA
in class org.xquark.util.DefaultXMLFilter
org.xml.sax.SAXException
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
comment
in class org.xquark.util.DefaultXMLFilter
org.xml.sax.SAXException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |