Interface XMLWriter
- All Known Implementing Classes:
XMLWriterImpl
public interface XMLWriter
Developed as part of the CO-ODE project http://www.co-ode.org .
- Since:
- 2.0.0
- Author:
- Matthew Horridge, The University Of Manchester, Medical Informatics Group
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Causes all open elements, including the document root element, to be closed.Gets the Writer's namespace manager.void
setEncoding
(String encoding) Sets the encoding for the document that the RDF writer produces.void
setWrapAttributes
(boolean b) Causes the current element's attributes to be wrapped in the output.void
startDocument
(IRI rootElement) Starts writing the document.void
writeAttribute
(String attr, String val) Writes an attribute of the last element to be started (that has not been closed).void
writeAttribute
(IRI attr, String val) Writes an attribute of the last element to be started (that has not been closed).void
writeComment
(String commentText) void
Writes the closing tag of the last element to be started.void
writeStartElement
(IRI name) Writes the start of an element.void
writeTextContent
(String text) Writes a text element.
-
Method Details
-
setEncoding
Sets the encoding for the document that the RDF writer produces. The default encoding isUTF-8
.- Parameters:
encoding
- The encoding.
-
getNamespacePrefixes
XMLWriterNamespaceManager getNamespacePrefixes()Gets the Writer's namespace manager.- Returns:
- The namespace manager.
-
getXMLBase
String getXMLBase()- Returns:
- the XML base
-
setWrapAttributes
void setWrapAttributes(boolean b) Causes the current element's attributes to be wrapped in the output.- Parameters:
b
- Iftrue
then the attributes will be wrapped if they are long. Iffalse
then no attribute wrapping will occur.
-
startDocument
Starts writing the document. The root element will contain the namespace declarations and xml:base attribute.- Parameters:
rootElement
- The iri of the root element.
-
endDocument
void endDocument()Causes all open elements, including the document root element, to be closed. -
writeStartElement
Writes the start of an element.- Parameters:
name
- The tag name of the element to be written. This must be a valid QName. @throws IllegalElementNameException if the specified name is not a valid QName
-
writeEndElement
void writeEndElement()Writes the closing tag of the last element to be started. -
writeAttribute
Writes an attribute of the last element to be started (that has not been closed). Note: if the attribute is an iri, use writeAttribute(IRI, String- Parameters:
attr
- The name of the attributeval
- The value of the attribute
-
writeAttribute
Writes an attribute of the last element to be started (that has not been closed).- Parameters:
attr
- The name of the attributeval
- The value of the attribute
-
writeTextContent
Writes a text element.- Parameters:
text
- The text to be written
-
writeComment
- Parameters:
commentText
- comment text
-