Package net.ontopia.topicmaps.xml
Class TMXMLWriter
java.lang.Object
net.ontopia.topicmaps.xml.AbstractTopicMapExporter
net.ontopia.topicmaps.xml.TMXMLWriter
- All Implemented Interfaces:
TopicMapWriterIF
PUBLIC: A writer exporting topic maps (or fragments) to the TM/XML
syntax.
- Since:
- 3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final AttributesImplprotected static final Stringprotected static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class net.ontopia.topicmaps.xml.AbstractTopicMapExporter
add_ids, filter -
Constructor Summary
ConstructorsConstructorDescriptionTMXMLWriter(File out) PUBLIC: Creates a writer writing to the given file in UTF-8.TMXMLWriter(File out, String encoding) PUBLIC: Creates a writer writing to the given file in given encoding.TMXMLWriter(OutputStream out, String encoding) TMXMLWriter(Writer out) PUBLIC: Creates a writer writing to the given writer in the utf-8 character encoding.TMXMLWriter(Writer out, String encoding) PUBLIC: Creates a writer writing to the given writer in the given character encoding.INTERNAL: Creates a writer writing to the given ContentHandler. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()PUBLIC: Closes the Writer created for internal use.voidPUBLIC: Write the end tag of the document element (fragment mode only).voidgatherPrefixes(Collection topics) PUBLIC: Gets the namespace prefixes to be used (to be used in fragment exporting mode only).voidgatherPrefixes(TopicIF topic) PUBLIC: Gets the namespace prefixes to be used (to be used in fragment exporting mode only).PUBLIC: Returns the element type name of the document element.PRIVATE: Returns the namespace URI to prefix mapping maintained internally by the writer.protected StringgetSubjectIndicatorRef(TopicIF topic, LocatorIF indicator) voidsetAdditionalProperties(Map<String, Object> properties) Sets additional properties for the TMXMLWriter.voidsetDocumentElement(String docelem) PUBLIC: Sets the document element type name to use.voidstartTopicMap(TopicMapIF topicmap) PUBLIC: Writes the start tag of the document element (to be used in fragment exporting only).voidwrite(TopicMapIF topicmap) PUBLIC: Writes the given topic map to the underlying writer.voidwriteTopic(TopicIF topic) PUBLIC: Writes a single topic (fragment exporting mode only).voidwriteTopics(Collection topics) PUBLIC: Writes a set of topics (fragment exporting mode only).Methods inherited from class net.ontopia.topicmaps.xml.AbstractTopicMapExporter
addId, filterCollection, filterOk, getElementId, isValidXMLId, mayCollide, setFilter
-
Field Details
-
PROPERTY_PREFIXES
- See Also:
-
PROPERTY_DOCUMENT_ELEMENT
- See Also:
-
EMPTY_ATTR_LIST
-
EMPTY_NAMESPACE
- See Also:
-
EMPTY_LOCALNAME
- See Also:
-
NS_ISO
- See Also:
-
NS_XTM
- See Also:
-
NS_TM
- See Also:
-
XSD_ANYURI
- See Also:
-
XSD_STRING
- See Also:
-
-
Constructor Details
-
TMXMLWriter
PUBLIC: Creates a writer writing to the given writer in the utf-8 character encoding.- Throws:
IOException
-
TMXMLWriter
PUBLIC: Creates a writer writing to the given writer in the given character encoding.- Throws:
IOExceptionIOExceptionIOException- Since:
- 3.2
-
TMXMLWriter
PUBLIC: Creates a writer writing to the given file in UTF-8.- Throws:
IOException- Since:
- 3.2
-
TMXMLWriter
PUBLIC: Creates a writer writing to the given file in given encoding.- Throws:
IOException
-
TMXMLWriter
- Throws:
IOException
-
TMXMLWriter
INTERNAL: Creates a writer writing to the given ContentHandler.
-
-
Method Details
-
close
PUBLIC: Closes the Writer created for internal use. Call this method when you have finished using the fragment exporter interface on the topic map writer. Don't call this method if using the TopicMapWriterIF interface.- Throws:
IOException
-
getDocumentElement
PUBLIC: Returns the element type name of the document element. -
setDocumentElement
PUBLIC: Sets the document element type name to use. -
write
PUBLIC: Writes the given topic map to the underlying writer.- Specified by:
writein interfaceTopicMapWriterIF- Parameters:
topicmap- The topic map to be exported.- Throws:
IOException- Thrown if writing the topic map fails.
-
startTopicMap
PUBLIC: Writes the start tag of the document element (to be used in fragment exporting only).- Throws:
SAXException
-
gatherPrefixes
PUBLIC: Gets the namespace prefixes to be used (to be used in fragment exporting mode only). Must be called before startTopicMap. -
writeTopics
PUBLIC: Writes a set of topics (fragment exporting mode only).- Throws:
SAXException
-
writeTopic
PUBLIC: Writes a single topic (fragment exporting mode only).- Throws:
SAXException
-
endTopicMap
PUBLIC: Write the end tag of the document element (fragment mode only).- Throws:
SAXException
-
gatherPrefixes
PUBLIC: Gets the namespace prefixes to be used (to be used in fragment exporting mode only). Must be called before startTopicMap. -
getNamespaceURIMapping
PRIVATE: Returns the namespace URI to prefix mapping maintained internally by the writer. Never, ever call this method. It exists only for testing purposes. -
addPrefix
-
getSubjectIndicatorRef
-
setAdditionalProperties
Sets additional properties for the TMXMLWriter. Accepted properties:- 'documentElement' (String), corresponds to
setDocumentElement(java.lang.String) - 'prefixes' (Map), each key-value pair is passed to
addPrefix(java.lang.String, java.lang.String)as Strings.
- Specified by:
setAdditionalPropertiesin interfaceTopicMapWriterIF- Parameters:
properties-
- 'documentElement' (String), corresponds to
-