Print an event stream in XML format on a PrintWriter.
XMLPrinter
public XMLPrinter(OutputStream out)
XMLPrinter
public XMLPrinter(OutputStream out,
boolean autoFlush)
XMLPrinter
public XMLPrinter(Writer out)
XMLPrinter
public XMLPrinter(Writer out,
boolean autoFlush)
XMLPrinter
public XMLPrinter(Consumer out)
XMLPrinter
public XMLPrinter(Consumer out,
boolean autoFlush)
XMLPrinter
public XMLPrinter(PrintConsumer out,
boolean autoFlush)
To disambiguate between Writer and Consumer versions.
beginAttribute
public void beginAttribute(String attrName,
Object attrType)
Write a attribute for the current group.
This is only allowed immediately after a beginGroup.
- beginAttribute in interface Consumer
- beginAttribute in interface PrintConsumer
consume
public void consume(SeqPosition position)
Consume node at current position.
The caller may invalidate or change the position after consume returns,
so if the consumer wants to save it, it needs to copy it.
- consume in interface PositionConsumer
ignoring
public boolean ignoring()
True if consumer is ignoring rest of group.
The producer can use this information to skip ahead.
- ignoring in interface Consumer
- ignoring in interface PrintConsumer
isHtmlEmptyElementTag
public static boolean isHtmlEmptyElementTag(String name)
isWordChar
protected static final boolean isWordChar(char ch)
setStyle
public void setStyle(Object style)
toString
public static String toString(Object value)
Convert argument to string in XML syntax.
write
public void write(char[] buf,
int off,
int len)
- write in interface Consumer
writeBaseUri
public void writeBaseUri(Object uri)
Write/set the base-uri property of the current element or document.
Only allowed immediately following beginDocument, beginGroup,
or writeProcessingInstruction.
- writeBaseUri in interface XConsumer
writeCDATA
public void writeCDATA(char[] chars,
int offset,
int length)
- writeCDATA in interface XConsumer
writeComment
public void writeComment(char[] chars,
int offset,
int length)
- writeComment in interface XConsumer
writePosition
public void writePosition(AbstractSequence seq,
int ipos)
Consume a single position pair.
This PositionConsumer may assume the sequence does no reference
management; i.e. that copyPos is trivial and releasePos is
a no-op. If that is not the case, use consume(TreePosition) instead.
- writePosition in interface PositionConsumer