Package net.ontopia.topicmaps.xml
Class XTMTopicMapExporter
- java.lang.Object
-
- net.ontopia.topicmaps.xml.AbstractTopicMapExporter
-
- net.ontopia.topicmaps.xml.XTMTopicMapExporter
-
- Direct Known Subclasses:
XTMFragmentExporter
public class XTMTopicMapExporter extends AbstractTopicMapExporter
INTERNAL: Exports topic maps to the XTM 1.0 interchange format.
-
-
Field Summary
Fields Modifier and Type Field Description protected AttributesImpl
atts
protected static AttributesImpl
EMPTY_ATTR_LIST
protected static String
EMPTY_LOCALNAME
protected static String
EMPTY_NAMESPACE
protected boolean
export_srclocs
-
Fields inherited from class net.ontopia.topicmaps.xml.AbstractTopicMapExporter
add_ids, filter
-
-
Constructor Summary
Constructors Constructor Description XTMTopicMapExporter()
Used to initialize the XTM Exporter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
export(TopicMapIF tm)
INTERNAL: Default export method.void
export(TopicMapIF tm, ContentHandler dh)
INTERNAL: Traverses a Topic Map and emits SAX document handler events according to the Topic Map interchange format to the given document handler.boolean
getAddIds()
INTERNAL: Returns true if configured to add IDs to all elements.boolean
getExportSourceLocators()
INTERNAL: Returns true if source locators should be exported.protected String
getSubjectIndicatorRef(TopicIF topic, LocatorIF indicator)
INTERNAL: This method is used to get the string form of the subject indicator of a topic.protected void
reportInvalidLocator(LocatorIF locator)
void
setAddIds(boolean add_ids)
INTERNAL: Tells the exporter whether or not to add IDs to all elements.void
setExportSourceLocators(boolean export_srclocs)
INTERNAL: Set the flag that says whether source locators should be exported or not.protected void
writeAssociation(AssociationIF assoc, ContentHandler dh)
protected void
writeInstanceOf(TopicIF topic, ContentHandler dh)
protected void
writeInstanceOf(TypedIF typed, ContentHandler dh)
protected void
writeMembers(Collection roles, ContentHandler dh)
protected void
writeOccurrences(Collection occurrences, ContentHandler dh)
protected void
writeParameters(VariantNameIF variant, ContentHandler dh)
protected void
writeRoleSpec(TopicIF topic, ContentHandler dh)
protected void
writeScope(Collection scope, ContentHandler dh)
protected void
writeSubjectIdentity(TopicIF topic, ContentHandler dh)
protected void
writeTopic(TopicIF topic, ContentHandler dh)
protected void
writeTopicNames(Collection names, ContentHandler dh)
protected void
writeTopicRef(TopicIF topic, ContentHandler dh)
protected void
writeVariantName(VariantNameIF variant, ContentHandler dh)
protected void
writeVariants(Collection variants, ContentHandler dh)
-
Methods inherited from class net.ontopia.topicmaps.xml.AbstractTopicMapExporter
addId, filterCollection, filterOk, getElementId, isValidXMLId, mayCollide, setFilter
-
-
-
-
Field Detail
-
atts
protected AttributesImpl atts
-
EMPTY_ATTR_LIST
protected static final AttributesImpl EMPTY_ATTR_LIST
-
EMPTY_NAMESPACE
protected static final String EMPTY_NAMESPACE
- See Also:
- Constant Field Values
-
EMPTY_LOCALNAME
protected static final String EMPTY_LOCALNAME
- See Also:
- Constant Field Values
-
export_srclocs
protected boolean export_srclocs
-
-
Method Detail
-
getExportSourceLocators
public boolean getExportSourceLocators()
INTERNAL: Returns true if source locators should be exported.
-
setExportSourceLocators
public void setExportSourceLocators(boolean export_srclocs)
INTERNAL: Set the flag that says whether source locators should be exported or not.
-
getAddIds
public boolean getAddIds()
INTERNAL: Returns true if configured to add IDs to all elements.- Since:
- 2.0
-
setAddIds
public void setAddIds(boolean add_ids)
INTERNAL: Tells the exporter whether or not to add IDs to all elements. (Default: true.)- Since:
- 2.0
-
export
public void export(TopicMapIF tm) throws SAXException, IOException
INTERNAL: Default export method. An XML pretty printer is used and the output is written to stdout.- Throws:
SAXException
IOException
-
export
public void export(TopicMapIF tm, ContentHandler dh) throws SAXException
INTERNAL: Traverses a Topic Map and emits SAX document handler events according to the Topic Map interchange format to the given document handler.- Throws:
SAXException
-
writeTopic
protected void writeTopic(TopicIF topic, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeInstanceOf
protected void writeInstanceOf(TopicIF topic, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeInstanceOf
protected void writeInstanceOf(TypedIF typed, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeTopicNames
protected void writeTopicNames(Collection names, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeTopicRef
protected void writeTopicRef(TopicIF topic, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
getSubjectIndicatorRef
protected String getSubjectIndicatorRef(TopicIF topic, LocatorIF indicator)
INTERNAL: This method is used to get the string form of the subject indicator of a topic. If the subject indicator is the source locator of some object in the topic map, a special procedure is applied. If it is not, the address of the locator is just returned.If the subject indicator is of the form "base#fragment", where base is the base address of the topic map store, the returned address is "#fragment". If not, but the indicator is used for reification, the returned address is "id" + the object ID of the reified object.
This procedure is employed to ensure that this method produces the same results as AbstractTopicMapExporter.getElementId, which is necessary to avoid breaking reification of local objects on export.
-
writeSubjectIdentity
protected void writeSubjectIdentity(TopicIF topic, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeVariants
protected void writeVariants(Collection variants, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeVariantName
protected void writeVariantName(VariantNameIF variant, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeParameters
protected void writeParameters(VariantNameIF variant, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeScope
protected void writeScope(Collection scope, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeOccurrences
protected void writeOccurrences(Collection occurrences, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeAssociation
protected void writeAssociation(AssociationIF assoc, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeMembers
protected void writeMembers(Collection roles, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
writeRoleSpec
protected void writeRoleSpec(TopicIF topic, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
reportInvalidLocator
protected void reportInvalidLocator(LocatorIF locator)
-
-