|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.xml.PrettySerializingContentHandler
public class PrettySerializingContentHandler
This class provides for the formatted serialization of a SAX stream
to a Writer
.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private int |
depth
The depth is incremented on each startElement and decremented on each endElement. |
private FormatType |
formatting
|
private static char[] |
indentation
This allows for rapid output of whitespace. |
private boolean |
lookingForChars
It is possible that characters(...) will be called for adjacent pieces of text. |
private boolean |
pendingEndTag
One of the difficulties in SAX parsing is that it does not retain state. |
private Writer |
writer
|
Constructor Summary | |
---|---|
PrettySerializingContentHandler()
A formatting serializer that does not add whitespace to the document. |
|
PrettySerializingContentHandler(FormatType theFormat)
A formatting serializer that adds whitespace to the document according to the specified FormatType . |
|
PrettySerializingContentHandler(FormatType theFormat,
Writer theWriter)
A formatting serializer that adds whitespace to the document according to the specified FormatType . |
Method Summary | |
---|---|
void |
characters(char[] chars,
int start,
int length)
|
protected String |
decorateAttributeName(String attrName)
|
protected String |
decorateAttributeValue(String attrValue)
|
protected String |
decorateCharacters(String characters)
|
protected String |
decorateIndent(int indentLevel)
|
protected String |
decorateTagName(String tagName)
|
private void |
emitWhitespace(int indentLevel)
|
void |
endDocument()
|
void |
endElement(String uri,
String localname,
String qname)
|
void |
endPrefixMapping(String prefix)
|
protected String |
getEmptyTagEnd()
|
protected String |
getEndTagStart()
|
protected String |
getNewline()
|
protected String |
getPIEnd()
|
protected String |
getPIStart()
|
protected String |
getTagEnd()
|
protected String |
getTagStart()
|
private void |
handlePending()
|
void |
ignorableWhitespace(char[] chars,
int start,
int length)
|
void |
processingInstruction(String target,
String data)
|
void |
setDocumentLocator(Locator locator)
|
void |
skippedEntity(String name)
|
void |
startDocument()
|
void |
startElement(String uri,
String localname,
String qname,
Attributes attrs)
|
void |
startPrefixMapping(String prefix,
String uri)
|
String |
toString()
|
protected void |
write(char obj)
|
protected void |
write(String obj)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static char[] indentation
private int depth
private boolean lookingForChars
private boolean pendingEndTag
private FormatType formatting
private Writer writer
Constructor Detail |
---|
public PrettySerializingContentHandler()
public PrettySerializingContentHandler(FormatType theFormat)
FormatType
. This uses
a StringWriter and the toString method will return its content.
theFormat
- the formatting to usepublic PrettySerializingContentHandler(FormatType theFormat, Writer theWriter)
FormatType
. As the document
is serialized it is written to the provided Writer
.
theFormat
- the formatting to usetheWriter
- the writer to useMethod Detail |
---|
public String toString()
toString
in class Object
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
public void startDocument()
startDocument
in interface ContentHandler
public void endDocument()
endDocument
in interface ContentHandler
public void startPrefixMapping(String prefix, String uri)
startPrefixMapping
in interface ContentHandler
public void endPrefixMapping(String prefix)
endPrefixMapping
in interface ContentHandler
public void startElement(String uri, String localname, String qname, Attributes attrs)
startElement
in interface ContentHandler
public void endElement(String uri, String localname, String qname)
endElement
in interface ContentHandler
public void characters(char[] chars, int start, int length)
characters
in interface ContentHandler
public void ignorableWhitespace(char[] chars, int start, int length)
ignorableWhitespace
in interface ContentHandler
public void processingInstruction(String target, String data)
processingInstruction
in interface ContentHandler
public void skippedEntity(String name)
skippedEntity
in interface ContentHandler
protected String getTagStart()
protected String getTagEnd()
protected String getEmptyTagEnd()
protected String getEndTagStart()
protected String getPIStart()
protected String getPIEnd()
protected String getNewline()
protected String decorateTagName(String tagName)
protected String decorateAttributeName(String attrName)
protected String decorateAttributeValue(String attrValue)
protected String decorateCharacters(String characters)
protected String decorateIndent(int indentLevel)
protected void write(String obj)
protected void write(char obj)
private void handlePending()
private void emitWhitespace(int indentLevel)
|
Copyright ? 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |