org.coode.xml
Interface XMLWriter

All Known Implementing Classes:
XMLWriterImpl

public interface XMLWriter

User: matthewhorridge
The Univeristy Of Manchester
Medical Informatics Group
Date: May 30, 2006

matthew.horridge@cs.man.ac.uk
www.cs.man.ac.uk/~horridgm

Developed as part of the CO-ODE project http://www.co-ode.org


Method Summary
 void endDocument()
          Causes all open elements, including the document root element, to be closed.
 XMLWriterNamespaceManager getNamespacePrefixes()
          Gets the Writer's namespace manager.
 java.lang.String getXMLBase()
           
 void setEncoding(java.lang.String encoding)
          Sets the encoding for the document that the rdfwriter produces.
 void setWrapAttributes(boolean b)
          Causes the current element's attributes to be wrapped in the output.
 void startDocument(java.lang.String rootElementName)
          Starts writing the document.
 void writeAttribute(java.lang.String attr, java.lang.String val)
          Writes an attribute of the last element to be started (that has not been closed).
 void writeComment(java.lang.String commentText)
           
 void writeEndElement()
          Writes the closing tag of the last element to be started.
 void writeStartElement(java.lang.String name)
          Writes the start of an element.
 void writeTextContent(java.lang.String text)
          Writes a text element
 

Method Detail

setEncoding

void setEncoding(java.lang.String encoding)
Sets the encoding for the document that the rdfwriter produces. The default encoding is "UTF-8".

Parameters:
encoding - The encoding.

getNamespacePrefixes

XMLWriterNamespaceManager getNamespacePrefixes()
Gets the Writer's namespace manager.

Returns:
The namespace manager.

getXMLBase

java.lang.String getXMLBase()

setWrapAttributes

void setWrapAttributes(boolean b)
Causes the current element's attributes to be wrapped in the output.

Parameters:
b - If true then the attributes will be wrapped if they are long. If false then no attribute wrapping will occur.

startDocument

void startDocument(java.lang.String rootElementName)
                   throws java.io.IOException
Starts writing the document. The root element will contain the namespace declarations and xml:base attribute.

Parameters:
rootElementName - The name of the root element.
Throws:
java.io.IOException - if there was an IO problem

endDocument

void endDocument()
                 throws java.io.IOException
Causes all open elements, including the document root element, to be closed.

Throws:
java.io.IOException - if there was an IO problem

writeStartElement

void writeStartElement(java.lang.String name)
                       throws java.io.IOException,
                              IllegalElementNameException
Writes the start of an element.

Parameters:
name - The tag name of the element to be written. This must be a valid QName.
Throws:
java.io.IOException - if there was an IO problem
IllegalElementNameException - if the specified name is not a valid QName

writeEndElement

void writeEndElement()
                     throws java.io.IOException
Writes the closing tag of the last element to be started.

Throws:
java.io.IOException - if there was an IO problem

writeAttribute

void writeAttribute(java.lang.String attr,
                    java.lang.String val)
                    throws java.io.IOException
Writes an attribute of the last element to be started (that has not been closed).

Parameters:
attr - The name of the attribute
val - The value of the attribute
Throws:
java.io.IOException - if there was an IO problem

writeTextContent

void writeTextContent(java.lang.String text)
                      throws java.io.IOException
Writes a text element

Parameters:
text - The text to be written
Throws:
java.io.IOException - if there was an IO problem

writeComment

void writeComment(java.lang.String commentText)
                  throws java.io.IOException
Throws:
java.io.IOException