Class XMLWriterImpl
java.lang.Object
org.semanticweb.owlapi.rdf.rdfxml.renderer.XMLWriterImpl
- All Implemented Interfaces:
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
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionXMLWriterImpl
(PrintWriter writer, XMLWriterNamespaceManager xmlWriterNamespaceManager, String xmlBase, OWLOntologyWriterConfiguration preferences) -
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.
-
Constructor Details
-
XMLWriterImpl
public XMLWriterImpl(PrintWriter writer, XMLWriterNamespaceManager xmlWriterNamespaceManager, String xmlBase, OWLOntologyWriterConfiguration preferences) - Parameters:
writer
- writerxmlWriterNamespaceManager
- namespace managerxmlBase
- XML basepreferences
- XML writer preferences instance
-
-
Method Details
-
getDefaultNamespace
- Returns:
- default namespace
-
getXMLBase
- Specified by:
getXMLBase
in interfaceXMLWriter
- Returns:
- the XML base
-
getNamespacePrefixes
Description copied from interface:XMLWriter
Gets the Writer's namespace manager.- Specified by:
getNamespacePrefixes
in interfaceXMLWriter
- Returns:
- The namespace manager.
-
setEncoding
Description copied from interface:XMLWriter
Sets the encoding for the document that the RDF writer produces. The default encoding isUTF-8
.- Specified by:
setEncoding
in interfaceXMLWriter
- Parameters:
encoding
- The encoding.
-
setWrapAttributes
public void setWrapAttributes(boolean b) Description copied from interface:XMLWriter
Causes the current element's attributes to be wrapped in the output.- Specified by:
setWrapAttributes
in interfaceXMLWriter
- Parameters:
b
- Iftrue
then the attributes will be wrapped if they are long. Iffalse
then no attribute wrapping will occur.
-
writeStartElement
Description copied from interface:XMLWriter
Writes the start of an element.- Specified by:
writeStartElement
in interfaceXMLWriter
- 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
public void writeEndElement()Description copied from interface:XMLWriter
Writes the closing tag of the last element to be started.- Specified by:
writeEndElement
in interfaceXMLWriter
-
writeAttribute
Description copied from interface:XMLWriter
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- Specified by:
writeAttribute
in interfaceXMLWriter
- Parameters:
attr
- The name of the attributeval
- The value of the attribute
-
writeAttribute
Description copied from interface:XMLWriter
Writes an attribute of the last element to be started (that has not been closed).- Specified by:
writeAttribute
in interfaceXMLWriter
- Parameters:
attr
- The name of the attributeval
- The value of the attribute
-
writeTextContent
Description copied from interface:XMLWriter
Writes a text element.- Specified by:
writeTextContent
in interfaceXMLWriter
- Parameters:
text
- The text to be written
-
writeComment
- Specified by:
writeComment
in interfaceXMLWriter
- Parameters:
commentText
- comment text
-
startDocument
Description copied from interface:XMLWriter
Starts writing the document. The root element will contain the namespace declarations and xml:base attribute.- Specified by:
startDocument
in interfaceXMLWriter
- Parameters:
rootElement
- The iri of the root element.
-
endDocument
public void endDocument()Description copied from interface:XMLWriter
Causes all open elements, including the document root element, to be closed.- Specified by:
endDocument
in interfaceXMLWriter
-