Class XMLWriter
java.lang.Object
org.apache.catalina.util.XMLWriter
XMLWriter helper class. writeText is the only method in the class doing
XML escaping.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBuilderBuffer.static final intClosing tag.protected booleanFlag to track whether the last write operation was an opening tag.static final intElement with no content.static final intOpening tag.protected final WriterWriter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsendData()Send data and reinitializes buffer, if a writer has been specified.toString()Retrieve generated XML.voidWrite data.voidwriteElement(String namespace, String name, int type) Write an element.voidwriteElement(String namespace, String namespaceInfo, String name, int type) Write an element.voidwriteProperty(String namespace, String name, String value) Write property to the XML.voidWrite raw XML data.voidWrite text.voidWrite XML Header.
-
Field Details
-
OPENING
public static final int OPENINGOpening tag.- See Also:
-
CLOSING
public static final int CLOSINGClosing tag.- See Also:
-
NO_CONTENT
public static final int NO_CONTENTElement with no content.- See Also:
-
buffer
Buffer. -
writer
Writer. -
lastWriteWasOpen
protected boolean lastWriteWasOpenFlag to track whether the last write operation was an opening tag.
-
-
Constructor Details
-
XMLWriter
public XMLWriter()New XML writer utility that will store its data in an internal buffer. -
XMLWriter
New XML writer utility that will store its data in an internal buffer and can write it to the specified writer.See
sendData()- Parameters:
writer- The writer to use
-
-
Method Details
-
toString
-
writeProperty
-
writeElement
-
writeElement
-
writeText
Write text. It will be escaped for XML.- Parameters:
text- Text to append
-
writeRaw
-
writeData
-
writeXMLHeader
public void writeXMLHeader()Write XML Header. -
sendData
Send data and reinitializes buffer, if a writer has been specified.- Throws:
IOException- Error writing XML data
-