|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.ontopia.xml.PrettyPrinter
public class PrettyPrinter
INTERNAL: SAX document handler that writes pretty-printed XML to a Writer.
Field Summary | |
---|---|
protected boolean |
dropControlChars
|
protected int |
encodeCharsFrom
|
protected java.lang.String |
encoding
|
protected int |
level
|
protected int |
offset
|
protected char[] |
startline
|
protected boolean[] |
subelements
|
protected java.io.Writer |
writer
|
Constructor Summary | |
---|---|
PrettyPrinter(java.io.OutputStream stream)
Creates a PrettyPrinter that writes to the given OutputStream. |
|
PrettyPrinter(java.io.OutputStream stream,
java.lang.String encoding)
Creates a PrettyPrinter that writes to the given OutputStream in the requested character encoding. |
|
PrettyPrinter(java.io.Writer writer,
java.lang.String encoding)
Creates a PrettyPrinter that writes to the given Writer. |
Method Summary | |
---|---|
void |
addUnescaped(java.lang.String content)
INTERNAL: Add given text unmodified and unescaped to the output. |
void |
characters(char[] ch,
int start,
int length)
|
void |
endDocument()
|
void |
endElement(java.lang.String name)
|
protected void |
escapeAttrValue(java.lang.String attrval,
java.io.Writer writer)
|
protected void |
flush(java.io.Writer writer)
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
protected void |
indent()
|
static void |
main(java.lang.String[] args)
Main method to allow PrettyPrinter to be used from the command-line. |
protected void |
makeStartLineBuffer(int size)
|
protected void |
makeSubelements(int size)
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
|
void |
setDocumentLocator(org.xml.sax.Locator locator)
|
void |
setDropControlCharacters(boolean dropControlChars)
INTERNAL: If this property is true control characters are being dropped from the resulting document. |
void |
setEncodeCharactersFrom(int charnumber)
INTERNAL: Encodes element content as decimal character entitites for characters from the given character number. |
void |
startDocument()
|
void |
startElement(java.lang.String name,
org.xml.sax.AttributeList atts)
|
protected void |
write(java.io.Writer writer,
char c)
|
protected void |
write(java.io.Writer writer,
char[] c,
int off,
int len)
|
protected void |
write(java.io.Writer writer,
java.lang.String s)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.Writer writer
protected java.lang.String encoding
protected boolean[] subelements
protected char[] startline
protected int offset
protected int level
protected int encodeCharsFrom
protected boolean dropControlChars
Constructor Detail |
---|
public PrettyPrinter(java.io.OutputStream stream) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public PrettyPrinter(java.io.OutputStream stream, java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public PrettyPrinter(java.io.Writer writer, java.lang.String encoding)
encoding
- The encoding to report in the XML declaration. If null,
no XML declaration will be output.Method Detail |
---|
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public void startDocument()
startDocument
in interface org.xml.sax.DocumentHandler
public void startElement(java.lang.String name, org.xml.sax.AttributeList atts)
startElement
in interface org.xml.sax.DocumentHandler
public void endElement(java.lang.String name)
endElement
in interface org.xml.sax.DocumentHandler
public void characters(char[] ch, int start, int length)
characters
in interface org.xml.sax.DocumentHandler
public void ignorableWhitespace(char[] ch, int start, int length)
ignorableWhitespace
in interface org.xml.sax.DocumentHandler
public void processingInstruction(java.lang.String target, java.lang.String data)
processingInstruction
in interface org.xml.sax.DocumentHandler
public void endDocument()
endDocument
in interface org.xml.sax.DocumentHandler
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.DocumentHandler
public void setEncodeCharactersFrom(int charnumber)
public void setDropControlCharacters(boolean dropControlChars)
public void addUnescaped(java.lang.String content)
protected void write(java.io.Writer writer, java.lang.String s)
protected void write(java.io.Writer writer, char c)
protected void write(java.io.Writer writer, char[] c, int off, int len)
protected void flush(java.io.Writer writer)
protected void indent()
protected void escapeAttrValue(java.lang.String attrval, java.io.Writer writer)
protected void makeStartLineBuffer(int size)
protected void makeSubelements(int size)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |