public class XMLPrinter extends PrintConsumer implements PositionConsumer, XConsumer
Modifier and Type | Field and Description |
---|---|
boolean |
canonicalizeCDATA |
static ThreadLocation |
doctypePublic
The system identifier emitted in a DOCTYPE declaration.
|
static ThreadLocation |
doctypeSystem
Fluid parameter to control whether a DOCTYPE declaration is emitted.
|
boolean |
escapeNonAscii |
boolean |
escapeText |
boolean |
extended |
boolean |
indentAttributes
When indenting, should attributes be lined up?
|
static ThreadLocation<java.lang.String> |
indentLoc |
protected int |
printIndent |
int |
useEmptyElementTag
Handling of empty elements.
|
base, skipping
Constructor and Description |
---|
XMLPrinter(Consumer out) |
XMLPrinter(java.io.OutputStream out) |
XMLPrinter(PrintConsumer out) |
XMLPrinter(java.io.Writer out) |
XMLPrinter(java.io.Writer out,
boolean autoFlush) |
Modifier and Type | Method and Description |
---|---|
void |
beginComment() |
void |
beginEntity(java.lang.Object base) |
void |
closeTag() |
void |
endAttribute()
End of an attribute or end of an actual parameter.
|
void |
endComment() |
void |
endDocument() |
void |
endElement() |
void |
endEntity() |
protected void |
endNumber() |
void |
error(java.lang.String msg,
java.lang.String code) |
static java.lang.String |
formatDecimal(java.math.BigDecimal dec)
Format java.math.BigDecimal as needed for XPath/XQuery's xs:decimal.
|
static java.lang.String |
formatDouble(double d)
Helper to format xs:double according to XPath/XQuery specification.
|
static java.lang.String |
formatFloat(float f)
Helper to format xs:float according to XPath/XQuery specification.
|
protected java.lang.String |
getHtmlTag(java.lang.Object type) |
boolean |
ignoring()
True if consumer is ignoring rest of element.
|
static boolean |
isHtmlEmptyElementTag(java.lang.String name) |
static XMLPrinter |
make(Consumer out,
java.lang.Object style) |
void |
print(java.lang.Object v) |
void |
setCanonicalizeCDATA(boolean v) |
void |
setEscapeNonAscii(boolean v) |
void |
setEscapeText(boolean v) |
void |
setExtended(boolean v) |
void |
setIndent(int v)
Controls whether to add extra indentation.
|
void |
setPrintXMLdecl(boolean value) |
void |
setStyle(java.lang.Object style) |
void |
setUseEmptyElementTag(int v) |
void |
startAttribute(java.lang.Object attrType)
Write a attribute for the current element.
|
void |
startDocument() |
void |
startElement(java.lang.Object type) |
protected void |
startNumber() |
static java.lang.String |
toString(java.lang.Object value)
Convert argument to string in XML syntax.
|
void |
write(char[] buf,
int off,
int len) |
void |
write(int v) |
void |
write(java.lang.String str,
int start,
int length) |
void |
writeBaseUri(java.lang.Object uri) |
void |
writeBoolean(boolean v) |
void |
writeCDATA(char[] chars,
int offset,
int length) |
void |
writeComment(char[] chars,
int offset,
int length) |
void |
writeComment(java.lang.String chars) |
void |
writeDoctype(java.lang.String tagname,
java.lang.String systemId,
java.lang.String publicId) |
void |
writeDoctypeIfDefined(java.lang.String tagname)
Write DOCTYPE using ThreadLocations doctypeSystem and doctypePublic
|
void |
writeDouble(double d) |
void |
writeFloat(float f) |
void |
writeObject(java.lang.Object v) |
void |
writePosition(AbstractSequence seq,
int ipos)
Consume a single position pair.
|
void |
writePosition(SeqPosition position)
Consume node at current position.
|
void |
writeProcessingInstruction(java.lang.String target,
char[] content,
int offset,
int length) |
protected void |
writeQName(java.lang.Object name) |
append, append, append, beforeContent, beforeNode, clearWordEnd, endHiderSection, endLogicalBlock, endLogicalBlock, freshLine, getPrettyWriter, isDomTerm, setIndentation, startHiderSection, startLogicalBlock, startLogicalBlock, startLogicalBlock, write, writeBreak, writeBreakFill, writeBreakFill, writeBreakLinear, writeInt, writeLong, writeRaw, writeRaw, writeRaw, writeRaw, writeShowHideButton, writeSpace, writeSpaceFill, writeSpaceFill, writeSpaceLinear, writeWordEnd, writeWordStart
checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected int printIndent
public boolean indentAttributes
public boolean canonicalizeCDATA
public int useEmptyElementTag
<br></br>
.
1: Use XML-style empty element tags: <br/>
2: Use HTML-compatible empty element tags: <br />
but <p></p>
.public boolean escapeText
public boolean escapeNonAscii
public boolean extended
public static final ThreadLocation doctypeSystem
public static final ThreadLocation doctypePublic
public static final ThreadLocation<java.lang.String> indentLoc
public XMLPrinter(java.io.Writer out, boolean autoFlush)
public XMLPrinter(java.io.Writer out)
public XMLPrinter(Consumer out)
public XMLPrinter(PrintConsumer out)
public XMLPrinter(java.io.OutputStream out)
public void setPrintXMLdecl(boolean value)
public static XMLPrinter make(Consumer out, java.lang.Object style)
public static java.lang.String toString(java.lang.Object value)
public void setStyle(java.lang.Object style)
public void setEscapeText(boolean v)
public void setEscapeNonAscii(boolean v)
public void setCanonicalizeCDATA(boolean v)
public void setUseEmptyElementTag(int v)
public void setExtended(boolean v)
public void setIndent(int v)
public void write(int v)
write
in class java.io.PrintWriter
public void writeBoolean(boolean v)
writeBoolean
in class PrintConsumer
protected void startNumber()
startNumber
in class PrintConsumer
protected void endNumber()
endNumber
in class PrintConsumer
public void closeTag()
public void startDocument()
startDocument
in class PrintConsumer
public void endDocument()
endDocument
in class PrintConsumer
public void beginEntity(java.lang.Object base)
beginEntity
in interface XConsumer
beginEntity
in class PrintConsumer
public void endEntity()
endEntity
in interface XConsumer
endEntity
in class PrintConsumer
protected void writeQName(java.lang.Object name)
public void writeDoctypeIfDefined(java.lang.String tagname)
public void writeDoctype(java.lang.String tagname, java.lang.String systemId, java.lang.String publicId)
public void startElement(java.lang.Object type)
startElement
in class PrintConsumer
public static boolean isHtmlEmptyElementTag(java.lang.String name)
protected java.lang.String getHtmlTag(java.lang.Object type)
public void endElement()
endElement
in class PrintConsumer
public void startAttribute(java.lang.Object attrType)
startAttribute
in class PrintConsumer
public void endAttribute()
Consumer
endAttribute
in class PrintConsumer
public void writeDouble(double d)
writeDouble
in class PrintConsumer
public void writeFloat(float f)
writeFloat
in class PrintConsumer
public static java.lang.String formatDouble(double d)
public static java.lang.String formatFloat(float f)
public static java.lang.String formatDecimal(java.math.BigDecimal dec)
public void print(java.lang.Object v)
print
in class java.io.PrintWriter
public void writeObject(java.lang.Object v)
writeObject
in class PrintConsumer
public boolean ignoring()
ignoring
in class PrintConsumer
public void write(java.lang.String str, int start, int length)
write
in class java.io.PrintWriter
public void write(char[] buf, int off, int len)
write
in class java.io.PrintWriter
public void writePosition(AbstractSequence seq, int ipos)
PositionConsumer
writePosition
in interface PositionConsumer
public void writeBaseUri(java.lang.Object uri)
public void beginComment()
public void endComment()
public void writeComment(java.lang.String chars)
public void writeComment(char[] chars, int offset, int length)
writeComment
in interface XConsumer
writeComment
in class PrintConsumer
public void writeCDATA(char[] chars, int offset, int length)
writeCDATA
in interface XConsumer
writeCDATA
in class PrintConsumer
public void writeProcessingInstruction(java.lang.String target, char[] content, int offset, int length)
writeProcessingInstruction
in interface XConsumer
writeProcessingInstruction
in class PrintConsumer
public void writePosition(SeqPosition position)
PositionConsumer
writePosition
in interface PositionConsumer
public void error(java.lang.String msg, java.lang.String code)