|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A simple serializer for XML documents, which is writing to
an instance of Writer
.
Method Summary | |
boolean |
canEncode(char pChar)
Returns whether the XMLWriter can encode the character c without an escape sequence like &#ddd;. |
java.lang.String |
getEncoding()
Returns the writers encoding. |
java.lang.String |
getIndentString()
Returns the string being used to indent an XML element by one level. |
java.lang.String |
getLineFeed()
Returns the line terminator. |
java.io.Writer |
getWriter()
Returns the target Writer . |
boolean |
isDeclarating()
Returns, whether an XML declaration is being generated. |
boolean |
isFlushing()
Returns, whether the method ContentHandler.endDocument()
should do a flush on the target stream. |
boolean |
isIndenting()
Returns, whether the XMLWriter is indenting
(pretty printing). |
void |
setDeclarating(boolean pDeclarating)
Sets, whether an XML declaration is being generated. |
void |
setEncoding(java.lang.String pEncoding)
Sets the writers encoding. |
void |
setFlushing(boolean pFlushing)
Sets, whether the method ContentHandler.endDocument()
should do a flush on the target stream. |
void |
setIndenting(boolean pIndenting)
Returns, whether the XMLWriter is indenting
(pretty printing). |
void |
setIndentString(java.lang.String pIndentString)
Sets the string being used to indent an XML element by one level. |
void |
setLineFeed(java.lang.String pLineFeed)
Sets the line terminator. |
void |
setWriter(java.io.Writer pWriter)
Sets the target Writer . |
Methods inherited from interface org.xml.sax.ContentHandler |
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping |
Method Detail |
public void setEncoding(java.lang.String pEncoding)
pEncoding
- Writers encoding, by default null, in
which case UTF-8 is being used.public java.lang.String getEncoding()
public void setDeclarating(boolean pDeclarating)
pDeclarating
- Whether an XML declaration is generated. Defaults
to false.public boolean isDeclarating()
public void setWriter(java.io.Writer pWriter)
Writer
. This is typically an instance
of BufferedWriter
, which is connected to an
instance of OutputStreamWriter
with an encoding
matching the XML documents encoding.
pWriter
- The target writer.public java.io.Writer getWriter()
Writer
. This is typically an instance
of BufferedWriter
, which is connected to an
instance of OutputStreamWriter
with an encoding
matching the XML documents encoding.
public boolean canEncode(char pChar)
Returns whether the XMLWriter can encode the character
c
without an escape sequence like &#ddd;.
pChar
- The character being checked for escaping.
public void setIndenting(boolean pIndenting)
XMLWriter
is indenting
(pretty printing). If you want indenting,
you should consider to invoke the methods
setIndentString(java.lang.String)
and
setLineFeed(java.lang.String)
as well.
pIndenting
- Whether indentation is enabled. Defaults to false.public boolean isIndenting()
XMLWriter
is indenting
(pretty printing). If you want indenting,
you should consider to invoke the methods
setIndentString(java.lang.String)
and
setLineFeed(java.lang.String)
as well.
public void setIndentString(java.lang.String pIndentString)
pIndentString
- The indentation string, by default " " (two blanks).public java.lang.String getIndentString()
public void setLineFeed(java.lang.String pLineFeed)
pLineFeed
- The line terminator, by default "\n"
(Line Feed). You might prefer "\r\n" (Carriage Return,
Line Feed), which is the default on Windows and related
operating systems.public java.lang.String getLineFeed()
public void setFlushing(boolean pFlushing)
ContentHandler.endDocument()
should do a flush on the target stream.
pFlushing
- True, if a flush should be done. Defaults to
false.public boolean isFlushing()
ContentHandler.endDocument()
should do a flush on the target stream.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |