Package org.apache.catalina.util
Class XMLWriter
java.lang.Object
org.apache.catalina.util.XMLWriter
XMLWriter helper class.
-
Field Summary
Modifier and TypeFieldDescriptionprotected StringBuilder
Buffer.static final int
Closing tag.protected boolean
static final int
Element with no content.static final int
Opening tag.protected final Writer
Writer. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
sendData()
Send data and reinitializes buffer, if a writer has been specified.toString()
Retrieve generated XML.void
Write data.void
writeElement
(String namespace, String name, int type) Write an element.void
writeElement
(String namespace, String namespaceInfo, String name, int type) Write an element.void
writeProperty
(String namespace, String name, String value) Write property to the XML.void
Write raw XML data.void
Write text.void
Write 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 lastWriteWasOpen
-
-
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
Retrieve generated XML. -
writeProperty
Write property to the XML.- Parameters:
namespace
- Namespacename
- Property namevalue
- Property value
-
writeElement
Write an element.- Parameters:
name
- Element namenamespace
- Namespace abbreviationtype
- Element type
-
writeElement
Write an element.- Parameters:
namespace
- Namespace abbreviationnamespaceInfo
- Namespace infoname
- Element nametype
- Element type
-
writeText
Write text.- Parameters:
text
- Text to append
-
writeRaw
Write raw XML data.- Parameters:
raw
- Raw XML to append
-
writeData
Write data.- Parameters:
data
- Data to append
-
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
-