public class ContentPrinter extends DefaultContentHandler
PrintStream
or sim.
PI_ENABLE_OUTPUT_ESCAPING
and
PI_DISABLE_OUTPUT_ESCAPING
.
Modifier and Type | Field and Description |
---|---|
protected int |
attcol |
protected java.util.Set<NamespaceName> |
cdata_elements |
protected boolean |
declareDoctype |
protected boolean |
elementPending |
protected boolean |
in_cdata |
protected int |
indent |
protected org.xml.sax.Locator |
locator |
static int |
maxwidth |
static java.lang.String |
newAttLineIndent |
static int |
newAttLineIndentLen |
protected boolean |
noCharEscape |
protected boolean |
noendtags |
protected java.io.PrintWriter |
out |
protected boolean |
pretty |
protected boolean |
reindent |
protected java.lang.String |
selectedEncoding |
static java.lang.String |
xml_version |
Constructor and Description |
---|
ContentPrinter(java.io.OutputStream out,
java.lang.String selectedEncoding)
Insert an enconder with the given encoding name between the
output and the selected drain.
|
ContentPrinter(java.io.OutputStream out,
java.lang.String selectedEncoding,
boolean pretty) |
ContentPrinter(java.io.OutputStream out,
java.lang.String selectedEncoding,
boolean pretty,
boolean noend)
Creates a ContentPrinter which can omit all end tags.
|
ContentPrinter(java.io.PrintStream out)
Deprecated.
Use constructor with PrintWriter instead, for selecting the
ecoding explicitly.
|
ContentPrinter(java.io.PrintStream out,
boolean pretty)
Deprecated.
Use constructor with PrintWriter instead, for selecting the
ecoding explicitly.
|
ContentPrinter(java.io.PrintStream out,
boolean pretty,
boolean noend)
Deprecated.
Use constructor with PrintWriter instead, for selecting the
ecoding explicitly.
|
ContentPrinter(java.io.PrintWriter out) |
ContentPrinter(java.io.PrintWriter out,
boolean pretty) |
ContentPrinter(java.io.PrintWriter out,
boolean pretty,
boolean noend) |
Modifier and Type | Method and Description |
---|---|
void |
add_cdata_tag(NamespaceName tag)
ATTENTION only elements with content model
|
void |
characters(char[] ch,
int start,
int length) |
void |
endDocument() |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName) |
void |
endPrefixMapping(java.lang.String prefix) |
void |
flush() |
protected void |
indent() |
protected void |
printAtt(java.lang.String s) |
void |
processingInstruction(java.lang.String target,
java.lang.String data) |
static java.lang.String |
quoteAttributeValue(java.lang.String v)
Cf.
|
void |
setDeclareDoctype(boolean declareDoctype)
Whether a doctype declaration shall be inserted in the generated output.
|
void |
setDocumentLocator(org.xml.sax.Locator locator) |
void |
skippedEntity(java.lang.String name) |
void |
startDocument() |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts) |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri) |
ignorableWhitespace
public static final java.lang.String xml_version
protected java.io.PrintWriter out
protected boolean pretty
protected boolean noendtags
protected boolean noCharEscape
protected transient boolean reindent
protected transient int indent
protected transient int attcol
public static final java.lang.String newAttLineIndent
public static final int newAttLineIndentLen
public static final int maxwidth
protected transient boolean elementPending
protected transient boolean declareDoctype
protected transient boolean in_cdata
protected java.util.Set<NamespaceName> cdata_elements
protected org.xml.sax.Locator locator
protected java.lang.String selectedEncoding
@Deprecated public ContentPrinter(java.io.PrintStream out)
@Deprecated public ContentPrinter(java.io.PrintStream out, boolean pretty)
@Deprecated public ContentPrinter(java.io.PrintStream out, boolean pretty, boolean noend)
public ContentPrinter(java.io.OutputStream out, java.lang.String selectedEncoding) throws java.io.UnsupportedEncodingException
XML 1.0
"java.io.UnsupportedEncodingException
public ContentPrinter(java.io.OutputStream out, java.lang.String selectedEncoding, boolean pretty) throws java.io.UnsupportedEncodingException
out
- where to print the output toselectedEncoding
- pretty
- whether to insert indentationsjava.io.UnsupportedEncodingException
public ContentPrinter(java.io.OutputStream out, java.lang.String selectedEncoding, boolean pretty, boolean noend) throws java.io.UnsupportedEncodingException
pretty==true
, for human readers, e.g. for debugging.out
- where to print the output toselectedEncoding
- pretty
- whether to insert indentationsnoend
- whether to leave out the end tagjava.io.UnsupportedEncodingException
public ContentPrinter(java.io.PrintWriter out)
public ContentPrinter(java.io.PrintWriter out, boolean pretty)
public ContentPrinter(java.io.PrintWriter out, boolean pretty, boolean noend)
public void setDeclareDoctype(boolean declareDoctype)
public void add_cdata_tag(NamespaceName tag)
public static java.lang.String quoteAttributeValue(java.lang.String v)
public void characters(char[] ch, int start, int length)
characters
in interface org.xml.sax.ContentHandler
characters
in class DefaultContentHandler
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
endElement
in interface org.xml.sax.ContentHandler
endElement
in class DefaultContentHandler
public void processingInstruction(java.lang.String target, java.lang.String data)
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class DefaultContentHandler
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
setDocumentLocator
in class DefaultContentHandler
public void skippedEntity(java.lang.String name)
skippedEntity
in interface org.xml.sax.ContentHandler
skippedEntity
in class DefaultContentHandler
public void startDocument()
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class DefaultContentHandler
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
startElement
in interface org.xml.sax.ContentHandler
startElement
in class DefaultContentHandler
protected void printAtt(java.lang.String s)
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
startPrefixMapping
in interface org.xml.sax.ContentHandler
startPrefixMapping
in class DefaultContentHandler
public void endPrefixMapping(java.lang.String prefix)
endPrefixMapping
in interface org.xml.sax.ContentHandler
endPrefixMapping
in class DefaultContentHandler
public void flush()
public void endDocument()
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class DefaultContentHandler
protected void indent()
see also the user documentation .