Package org.apache.catalina.util
Class XMLWriter
java.lang.Object
org.apache.catalina.util.XMLWriter
XMLWriter helper class.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected StringBuilderBuffer.static final intClosing tag.protected booleanstatic final intElement with no content.static final intOpening tag.protected final WriterWriter.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
OPENINGpublic static final int OPENINGOpening tag.- See Also:
 
- 
CLOSINGpublic static final int CLOSINGClosing tag.- See Also:
 
- 
NO_CONTENTpublic static final int NO_CONTENTElement with no content.- See Also:
 
- 
bufferBuffer.
- 
writerWriter.
- 
lastWriteWasOpenprotected boolean lastWriteWasOpen
 
- 
- 
Constructor Details- 
XMLWriterpublic XMLWriter()New XML writer utility that will store its data in an internal buffer.
- 
XMLWriterNew 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- 
toStringRetrieve generated XML.
- 
writePropertyWrite property to the XML.- Parameters:
- namespace- Namespace
- name- Property name
- value- Property value
 
- 
writeElementWrite an element.- Parameters:
- name- Element name
- namespace- Namespace abbreviation
- type- Element type
 
- 
writeElementWrite an element.- Parameters:
- namespace- Namespace abbreviation
- namespaceInfo- Namespace info
- name- Element name
- type- Element type
 
- 
writeTextWrite text.- Parameters:
- text- Text to append
 
- 
writeRawWrite raw XML data.- Parameters:
- raw- Raw XML to append
 
- 
writeDataWrite data.- Parameters:
- data- Data to append
 
- 
writeXMLHeaderpublic void writeXMLHeader()Write XML Header.
- 
sendDataSend data and reinitializes buffer, if a writer has been specified.- Throws:
- IOException- Error writing XML data
 
 
-