Package edu.umd.cs.findbugs.xml
Interface XMLOutput
-
- All Known Implementing Classes:
Dom4JXMLOutput,OutputStreamXMLOutput
@CleanupObligation public interface XMLOutput
Interface to generate an XML document in some form. E.g., writing it to a stream, generating SAX events, etc.- Author:
- David Hovemeyer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddAttribute(java.lang.String name, java.lang.String value)Add an attribute to a started tag.voidbeginDocument()Begin the XML document.voidcloseTag(java.lang.String tagName)Close tag with given name.voidfinish()Finish writing XML output, closing any underlying resources (such as output streams).voidopenCloseTag(java.lang.String tagName)Open and close tag with given name.voidopenCloseTag(java.lang.String tagName, XMLAttributeList attributeList)Open and close tag with given name and given attributes.voidopenTag(java.lang.String tagName)Open a tag with given name.voidopenTag(java.lang.String tagName, XMLAttributeList attributeList)Open a tag with given name and given attributes.voidstartTag(java.lang.String tagName)Start a tag, with the intention of adding attributes.voidstopTag(boolean close)End a started tag.voidwriteCDATA(java.lang.String cdata)Write a CDATA section to the XML document.voidwriteText(java.lang.String text)Write text to the XML document.
-
-
-
Method Detail
-
beginDocument
void beginDocument() throws java.io.IOExceptionBegin the XML document.- Throws:
java.io.IOException
-
openTag
void openTag(java.lang.String tagName) throws java.io.IOExceptionOpen a tag with given name.- Parameters:
tagName- the tag name- Throws:
java.io.IOException
-
openTag
void openTag(java.lang.String tagName, XMLAttributeList attributeList) throws java.io.IOExceptionOpen a tag with given name and given attributes.- Parameters:
tagName- the tag nameattributeList- the attributes- Throws:
java.io.IOException
-
startTag
void startTag(java.lang.String tagName) throws java.io.IOExceptionStart a tag, with the intention of adding attributes. Must be followed by stopTag after zero or more addAttribute calls.- Parameters:
tagName- the tag name- Throws:
java.io.IOException
-
addAttribute
void addAttribute(java.lang.String name, java.lang.String value) throws java.io.IOExceptionAdd an attribute to a started tag. Must follow a call to startTag.- Parameters:
name- the attribute name.value- the attribute value, unescaped.- Throws:
java.io.IOException
-
stopTag
void stopTag(boolean close) throws java.io.IOExceptionEnd a started tag. Must follow a call to startTag.- Parameters:
close- true if the element has no content.- Throws:
java.io.IOException
-
openCloseTag
void openCloseTag(java.lang.String tagName) throws java.io.IOExceptionOpen and close tag with given name.- Parameters:
tagName- the tag name- Throws:
java.io.IOException
-
openCloseTag
void openCloseTag(java.lang.String tagName, XMLAttributeList attributeList) throws java.io.IOExceptionOpen and close tag with given name and given attributes.- Parameters:
tagName- the tag nameattributeList- the attributes- Throws:
java.io.IOException
-
closeTag
void closeTag(java.lang.String tagName) throws java.io.IOExceptionClose tag with given name.- Parameters:
tagName- the tag name- Throws:
java.io.IOException
-
writeText
void writeText(java.lang.String text) throws java.io.IOExceptionWrite text to the XML document. XML metacharacters are automatically escaped.- Parameters:
text- the text to write- Throws:
java.io.IOException
-
writeCDATA
void writeCDATA(java.lang.String cdata) throws java.io.IOExceptionWrite a CDATA section to the XML document. The characters are not escaped in any way.- Parameters:
cdata- the character data to write- Throws:
java.io.IOException
-
finish
@DischargesObligation void finish() throws java.io.IOException
Finish writing XML output, closing any underlying resources (such as output streams). A call to this method should always be made, even if one of the XML-generation methods throws an exception. Therefore, a call to this method should be performed in a finally block.- Throws:
java.io.IOException
-
-