edu.umd.cs.findbugs.xml

Interface XMLOutput

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
voidaddAttribute(String name, String value)
Add an attribute to a started tag.
voidbeginDocument()
Begin the XML document.
voidcloseTag(String tagName)
Close tag with given name.
voidfinish()
Finish writing XML output, closing any underlying resources (such as output streams).
voidopenCloseTag(String tagName)
Open and close tag with given name.
voidopenCloseTag(String tagName, XMLAttributeList attributeList)
Open and close tag with given name and given attributes.
voidopenTag(String tagName)
Open a tag with given name.
voidopenTag(String tagName, XMLAttributeList attributeList)
Open a tag with given name and given attributes.
voidstartTag(String tagName)
Start a tag, with the intention of adding attributes.
voidstopTag(boolean close)
End a started tag.
voidwriteCDATA(String cdata)
Write a CDATA section to the XML document.
voidwriteText(String text)
Write text to the XML document.

Method Detail

addAttribute

public void addAttribute(String name, String value)
Add an attribute to a started tag. Must follow a call to startTag.

Parameters: name the attribute name. value the attribute value, unescaped.

beginDocument

public void beginDocument()
Begin the XML document.

closeTag

public void closeTag(String tagName)
Close tag with given name.

Parameters: tagName the tag name

finish

public void finish()
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.

openCloseTag

public void openCloseTag(String tagName)
Open and close tag with given name.

Parameters: tagName the tag name

openCloseTag

public void openCloseTag(String tagName, XMLAttributeList attributeList)
Open and close tag with given name and given attributes.

Parameters: tagName the tag name attributeList the attributes

openTag

public void openTag(String tagName)
Open a tag with given name.

Parameters: tagName the tag name

openTag

public void openTag(String tagName, XMLAttributeList attributeList)
Open a tag with given name and given attributes.

Parameters: tagName the tag name attributeList the attributes

startTag

public void startTag(String tagName)
Start a tag, with the intention of adding attributes. Must be followed by stopTag after zero or more addAttribute calls.

Parameters: tagName the tag name

stopTag

public void stopTag(boolean close)
End a started tag. Must follow a call to startTag.

Parameters: close true if the element has no content.

writeCDATA

public void writeCDATA(String cdata)
Write a CDATA section to the XML document. The characters are not escaped in any way.

Parameters: cdata the character data to write

writeText

public void writeText(String text)
Write text to the XML document. XML metacharacters are automatically escaped.

Parameters: text the text to write

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.