Package org.biojava.nbio.core.util
Class PrettyXMLWriter
- java.lang.Object
-
- org.biojava.nbio.core.util.PrettyXMLWriter
-
-
Constructor Summary
Constructors Constructor Description PrettyXMLWriter(java.io.PrintWriter writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattribute(java.lang.String qName, java.lang.String value)Add an un-qualified attribute to an element.voidattribute(java.lang.String nsURI, java.lang.String localName, java.lang.String value)Add an attribute to an element.voidclose()Close this XMLWriter, and it's underlying stream.voidcloseTag(java.lang.String qName)Closes an un-qualified element.voidcloseTag(java.lang.String nsURI, java.lang.String localName)Closes an elementvoiddeclareNamespace(java.lang.String nsURI, java.lang.String prefixHint)Hints that a namespace is going to be used in a sub-tree.protected voidnumericalEntity(char c)voidopenTag(java.lang.String qName)Open a new unqualified XML tag.voidopenTag(java.lang.String nsURI, java.lang.String localName)Open a new namespace-qualified XML tag.voidprint(java.lang.String data)Prints some textual content in an element.protected voidprintAttributeValue(java.lang.String data)protected voidprintChars(java.lang.String data)voidprintln(java.lang.String data)Prints some textual content, terminated with a newline character.voidprintRaw(java.lang.String data)Send raw data to the stream.protected voidwriteIndent()
-
-
-
Method Detail
-
declareNamespace
public void declareNamespace(java.lang.String nsURI, java.lang.String prefixHint) throws java.io.IOExceptionDescription copied from interface:XMLWriterHints that a namespace is going to be used in a sub-tree. Use this method to avoid namespaces that are used only in leaf-nodes of a tree being re-defined every time they are used. The XMLWriter will generally try to use the suggested prefix for this namespace, but there is no guarentee of this. In particular, if the namespace is already in use, the current prefix will still be used. Similarly if the suggested prefix has already been used for another namespace, a new one will be auto-generated.- Specified by:
declareNamespacein interfaceXMLWriter- Parameters:
nsURI- The namespace to declareprefixHint- A suggested prefix-string for this namespace.- Throws:
java.io.IOException
-
writeIndent
protected void writeIndent() throws java.io.IOException- Throws:
java.io.IOException
-
openTag
public void openTag(java.lang.String nsURI, java.lang.String localName) throws java.io.IOExceptionDescription copied from interface:XMLWriterOpen a new namespace-qualified XML tag.
-
openTag
public void openTag(java.lang.String qName) throws java.io.IOExceptionDescription copied from interface:XMLWriterOpen a new unqualified XML tag. This may also be used if you want to do namespace management yourself, independantly of the XMLWriter
-
attribute
public void attribute(java.lang.String nsURI, java.lang.String localName, java.lang.String value) throws java.io.IOExceptionDescription copied from interface:XMLWriterAdd an attribute to an element. This will throw an exception if it's not called immediately after anopenTagcommand.
-
attribute
public void attribute(java.lang.String qName, java.lang.String value) throws java.io.IOExceptionDescription copied from interface:XMLWriterAdd an un-qualified attribute to an element. This will throw an exception if it's not called immediately after anopenTagcommand.
-
closeTag
public void closeTag(java.lang.String nsURI, java.lang.String localName) throws java.io.IOExceptionDescription copied from interface:XMLWriterCloses an element
-
closeTag
public void closeTag(java.lang.String qName) throws java.io.IOExceptionDescription copied from interface:XMLWriterCloses an un-qualified element.
-
println
public void println(java.lang.String data) throws java.io.IOExceptionDescription copied from interface:XMLWriterPrints some textual content, terminated with a newline character.
-
print
public void print(java.lang.String data) throws java.io.IOExceptionDescription copied from interface:XMLWriterPrints some textual content in an element.
-
printRaw
public void printRaw(java.lang.String data) throws java.io.IOExceptionDescription copied from interface:XMLWriterSend raw data to the stream. Mainly useful for things like DOCTYPE declarations. Use with care!
-
printChars
protected void printChars(java.lang.String data) throws java.io.IOException- Throws:
java.io.IOException
-
printAttributeValue
protected void printAttributeValue(java.lang.String data) throws java.io.IOException- Throws:
java.io.IOException
-
numericalEntity
protected void numericalEntity(char c) throws java.io.IOException- Throws:
java.io.IOException
-
-