|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tm4j.topicmap.utils.XTMWriter
Field Summary | |
static java.lang.String |
OPTION_EXPORT_IMPLIED_IDS
|
static java.lang.String |
OPTION_EXPORT_RESOURCE_BASE
|
static java.lang.String |
OPTION_EXPORT_RESOURCE_IDS
|
static java.lang.String |
OPTION_IDREF_PREFIX
|
static java.lang.String |
OPTION_WRITE_AS_FRAGMENT
|
static java.lang.String |
OPTION_WRITE_STUB_TOPICS
|
static java.lang.String |
OPTION_XLINK_PREFIX
|
static java.lang.String |
OPTION_XTM_PREFIX
|
Constructor Summary | |
XTMWriter()
Creates a new XTMWriter object. |
Method Summary | |
void |
baseNameString(java.lang.String id,
java.lang.String value)
|
protected void |
characters(java.lang.String value)
|
protected void |
closeParameters()
|
protected void |
closeSubjectIdentity()
|
protected void |
closeTypes()
|
void |
endAssociation()
|
void |
endAssociation(Association assoc)
|
void |
endBaseName()
|
void |
endBaseName(BaseName bn)
|
void |
endInstanceOf()
|
void |
endMember()
|
void |
endMember(Member m)
|
void |
endMergeMap()
|
void |
endOccurrence()
|
void |
endOccurrence(Occurrence occ)
|
void |
endParameters()
|
void |
endRoleSpec()
|
void |
endScope()
|
void |
endSubjectIdentity()
|
void |
endTopic()
|
void |
endTopic(Topic t)
|
void |
endTopicMap()
|
void |
endTopicMap(TopicMap tm)
|
void |
endVariant()
|
void |
endVariant(Variant var)
|
void |
endVariantName()
|
protected void |
endXTMElement(java.lang.String localName)
|
protected java.lang.String |
getDocumentPart(java.lang.String addressString)
Returns that part of a URI locator address which preceeds the fragment separator '#' |
boolean |
getExportImpliedIDs()
Deprecated. from 0.9.0 |
boolean |
getExportResourceIDs()
Deprecated. from 0.9.0 |
protected java.lang.String |
getID(TopicMap tm)
|
protected java.lang.String |
getID(TopicMapObject tmo)
Returns the id attribute value to be exported for the specified TopicMapObject. |
java.lang.String |
getIDRefPrefix()
Deprecated. from 0.9.0 |
protected java.lang.String |
getResourceID(TopicMapObject tmo,
Locator srcLoc)
Returns the fragment part of tmo 's resourceLocator property if,
and only if the document part of the resourceLocator matches the doucment part
of the containing TopicMap object's resourceLocator property. |
java.lang.String |
getXLinkNSPrefix()
Deprecated. from 0.9.0 |
java.lang.String |
getXTMNSPrefix()
Deprecated. from 0.9.0 |
protected java.lang.String |
makeRelative(java.lang.String id)
|
void |
onParameter(Topic param)
|
void |
onPlayer(Topic p)
|
void |
onRoleSpec(Topic rs)
|
protected void |
onScopedObject(java.lang.String soID)
|
void |
onSubject(Locator subject)
|
void |
onSubjectIndicator(Locator subjInd)
|
void |
onTheme(Topic theme)
|
void |
onType(Topic type)
|
void |
onVariantName(VariantName varName)
|
protected void |
openParameters()
|
protected void |
openSubjectIdentity()
|
void |
ref(java.lang.String id,
int refType,
Locator refValue)
|
void |
ref(java.lang.String id,
int refType,
java.lang.String refValue)
|
void |
resourceData(java.lang.String id,
java.lang.String data)
|
void |
setContentHandler(org.xml.sax.ContentHandler h)
Sets the SAX ContentHandler to which export events will be notified. |
void |
setErrorHandler(org.xml.sax.ErrorHandler h)
Sets the SAX ErrorHandler to which export errors will be notified. |
void |
setExportImpliedIDs(boolean b)
Deprecated. from 0.9.0 use setProperty(OPTION_EXPORT_IMPLIED_IDS, String); |
void |
setExportResourceIDs(boolean b)
Deprecated. from 0.9.0 use setProperty(OPTION_EXPORT_RESOURCE_IDS, String); |
void |
setIDRefPrefix(java.lang.String idRefPrefix)
Deprecated. from 0.9.0 use setProperty(OPTION_IDREF_PREFIX, String); |
void |
setProperty(java.lang.String propertyName,
java.lang.String propertyValue)
|
void |
setWriteAsFragment(boolean asFragment)
Deprecated. from 0.9.0 use setProperty(OPTION_WRITE_AS_FRAGMENT, String); |
void |
setXLinkNSPrefix(java.lang.String nsPrefix)
Deprecated. from 0.9.0 use setProperty(OPTION_XLINK_PREFIX, String); |
void |
setXTMNSPrefix(java.lang.String nsPrefix)
Deprecated. from 0.9.0 use setProperty(OPTION_XTM_PREFIX, String); |
boolean |
startAssociation(Association assoc)
|
void |
startAssociation(java.lang.String id)
|
boolean |
startBaseName(BaseName bn)
|
void |
startBaseName(java.lang.String id)
|
void |
startInstanceOf(java.lang.String id)
|
boolean |
startMember(Member m)
|
void |
startMember(java.lang.String id)
|
void |
startMergeMap(java.lang.String id,
java.lang.String mergeMapURI)
|
boolean |
startOccurrence(Occurrence occ)
|
void |
startOccurrence(java.lang.String id)
|
void |
startParameters(java.lang.String id)
|
void |
startRoleSpec(java.lang.String id)
|
boolean |
startScope()
|
void |
startScope(java.lang.String id)
|
void |
startSubjectIdentity(java.lang.String id)
|
void |
startTopic(java.lang.String id)
|
boolean |
startTopic(Topic t)
|
void |
startTopicMap(java.lang.String id,
java.lang.String base)
|
boolean |
startTopicMap(TopicMap tm)
|
void |
startVariant(java.lang.String id)
|
boolean |
startVariant(Variant var)
|
void |
startVariantName(java.lang.String id)
|
protected void |
startXTMElement(java.lang.String localName,
org.xml.sax.Attributes atts)
|
protected void |
startXTMElement(java.lang.String localName,
java.lang.String id)
|
protected void |
startXTMElement(java.lang.String localName,
java.lang.String id,
java.lang.String href)
|
protected void |
topicRef(Topic t)
|
protected void |
writeBaseNameString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String OPTION_WRITE_AS_FRAGMENT
public static final java.lang.String OPTION_XTM_PREFIX
public static final java.lang.String OPTION_XLINK_PREFIX
public static final java.lang.String OPTION_IDREF_PREFIX
public static final java.lang.String OPTION_EXPORT_RESOURCE_IDS
public static final java.lang.String OPTION_EXPORT_RESOURCE_BASE
public static final java.lang.String OPTION_EXPORT_IMPLIED_IDS
public static final java.lang.String OPTION_WRITE_STUB_TOPICS
Constructor Detail |
public XTMWriter()
Method Detail |
public void setWriteAsFragment(boolean asFragment)
true
then no startDocument()
or endDocument() events will be generated.
asFragment
- true
to write the topic map as an
XML fragment, false
to write the topic map as
a separate document.public void setXTMNSPrefix(java.lang.String nsPrefix)
nsPrefix
- the XTM namespace prefix for this XTM file.public java.lang.String getXTMNSPrefix()
public void setXLinkNSPrefix(java.lang.String nsPrefix)
nsPrefix
- the XLink namespace prefix to be assigned.public java.lang.String getXLinkNSPrefix()
public void setIDRefPrefix(java.lang.String idRefPrefix)
public java.lang.String getIDRefPrefix()
setIDRefPrefix(String)
public boolean getExportResourceIDs()
setExportResourceIDs(boolean)
public void setExportResourceIDs(boolean b)
If this option is set to true
then for each object exported, if
that object has a value for its sourceLocators property and if the document
part of one of the sourceLocators values matches the document part of the resourceBase
property of the XTMWriter instance, then the fragment part of the sourceLocator value
will be exported as the id attribute value of the XTM element.
If the object being exported is a Topic and its sourceLocators property does not contain a value where the document part of the sourceLocator does not match the document part of the resourceBase value, then all of the Topic object's subjectIndicators will be checked and if one of those has a document part which matches the document part of the resourceBase value, then the fragment part of that subjectIndicator will be exported as the <topic> element's id attribute.
Note This setting overrides the exportImpliedIDs property - in other words, if exportImpliedIDs is false and exportResourceIDs is true, then id attributes will still be generated for any object with a non-empty sourceLocators value. If both settings are true, then the ID generated from the sourceLocators of the object takes precedence over the ID generated from the id property of the object.
b
- the new value of the exportResourceIDs optionpublic void setExportImpliedIDs(boolean b)
If this option is set to false
, then IDs will only be generated for <topic>
elements. Otherwise, IDs will be generated for all elements in the exported XTM file which
are created to represent an object in the TopicMap being exported.
b
- the new value for the exportImpliedIDs optionsetExportResourceIDs(boolean)
public boolean getExportImpliedIDs()
setExportImpliedIDs(boolean)
public void setContentHandler(org.xml.sax.ContentHandler h)
setContentHandler
in interface TopicMapWriter
h
- the ContentHandler to receive the SAX events generated by the export processpublic void setErrorHandler(org.xml.sax.ErrorHandler h)
setErrorHandler
in interface TopicMapWriter
h
- the ErrorHandler to receive any errors generated by the export process.public void setProperty(java.lang.String propertyName, java.lang.String propertyValue) throws WriterPropertyNotRecognizedException
WriterPropertyNotRecognizedException
protected void startXTMElement(java.lang.String localName, org.xml.sax.Attributes atts)
protected void startXTMElement(java.lang.String localName, java.lang.String id)
protected java.lang.String makeRelative(java.lang.String id)
protected void startXTMElement(java.lang.String localName, java.lang.String id, java.lang.String href)
protected void endXTMElement(java.lang.String localName)
protected void characters(java.lang.String value)
public void startTopicMap(java.lang.String id, java.lang.String base) throws TopicMapProcessingException
TopicMapProcessingException
public void endTopicMap() throws TopicMapProcessingException
TopicMapProcessingException
public void startTopic(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endTopic() throws TopicMapProcessingException
TopicMapProcessingException
public void startInstanceOf(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endInstanceOf() throws TopicMapProcessingException
TopicMapProcessingException
public void startSubjectIdentity(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endSubjectIdentity() throws TopicMapProcessingException
TopicMapProcessingException
public void startBaseName(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endBaseName() throws TopicMapProcessingException
TopicMapProcessingException
public void startOccurrence(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endOccurrence() throws TopicMapProcessingException
TopicMapProcessingException
public void startAssociation(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endAssociation() throws TopicMapProcessingException
TopicMapProcessingException
public void startMember(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endMember() throws TopicMapProcessingException
TopicMapProcessingException
public void startRoleSpec(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endRoleSpec() throws TopicMapProcessingException
TopicMapProcessingException
public void startMergeMap(java.lang.String id, java.lang.String mergeMapURI) throws TopicMapProcessingException
TopicMapProcessingException
public void endMergeMap() throws TopicMapProcessingException
TopicMapProcessingException
public void ref(java.lang.String id, int refType, Locator refValue) throws TopicMapProcessingException
TopicMapProcessingException
public void ref(java.lang.String id, int refType, java.lang.String refValue) throws TopicMapProcessingException
TopicMapProcessingException
public void resourceData(java.lang.String id, java.lang.String data) throws TopicMapProcessingException
TopicMapProcessingException
public void startScope(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endScope() throws TopicMapProcessingException
endScope
in interface WalkerHandler
TopicMapProcessingException
public void baseNameString(java.lang.String id, java.lang.String value) throws TopicMapProcessingException
TopicMapProcessingException
public void startVariant(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endVariant() throws TopicMapProcessingException
TopicMapProcessingException
public void startParameters(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endParameters() throws TopicMapProcessingException
TopicMapProcessingException
public void startVariantName(java.lang.String id) throws TopicMapProcessingException
TopicMapProcessingException
public void endVariantName() throws TopicMapProcessingException
TopicMapProcessingException
public boolean startTopicMap(TopicMap tm) throws TopicMapProcessingException
startTopicMap
in interface WalkerHandler
TopicMapProcessingException
public void endTopicMap(TopicMap tm) throws TopicMapProcessingException
endTopicMap
in interface WalkerHandler
TopicMapProcessingException
public boolean startTopic(Topic t) throws TopicMapProcessingException
startTopic
in interface WalkerHandler
TopicMapProcessingException
public void endTopic(Topic t) throws TopicMapProcessingException
endTopic
in interface WalkerHandler
TopicMapProcessingException
public void onType(Topic type) throws TopicMapProcessingException
onType
in interface WalkerHandler
TopicMapProcessingException
protected void closeTypes() throws TopicMapProcessingException
TopicMapProcessingException
protected void openSubjectIdentity() throws TopicMapProcessingException
TopicMapProcessingException
protected void closeSubjectIdentity() throws TopicMapProcessingException
TopicMapProcessingException
public void onSubject(Locator subject) throws TopicMapProcessingException
onSubject
in interface WalkerHandler
TopicMapProcessingException
public void onSubjectIndicator(Locator subjInd) throws TopicMapProcessingException
onSubjectIndicator
in interface WalkerHandler
TopicMapProcessingException
public boolean startBaseName(BaseName bn) throws TopicMapProcessingException
startBaseName
in interface WalkerHandler
TopicMapProcessingException
public void endBaseName(BaseName bn) throws TopicMapProcessingException
endBaseName
in interface WalkerHandler
TopicMapProcessingException
protected void writeBaseNameString() throws TopicMapProcessingException
TopicMapProcessingException
public boolean startScope() throws TopicMapProcessingException
startScope
in interface WalkerHandler
TopicMapProcessingException
public void onTheme(Topic theme) throws TopicMapProcessingException
onTheme
in interface WalkerHandler
TopicMapProcessingException
protected void topicRef(Topic t) throws TopicMapProcessingException
TopicMapProcessingException
public boolean startVariant(Variant var) throws TopicMapProcessingException
startVariant
in interface WalkerHandler
TopicMapProcessingException
public void endVariant(Variant var) throws TopicMapProcessingException
endVariant
in interface WalkerHandler
TopicMapProcessingException
protected void openParameters() throws TopicMapProcessingException
TopicMapProcessingException
protected void closeParameters() throws TopicMapProcessingException
TopicMapProcessingException
public void onParameter(Topic param) throws TopicMapProcessingException
onParameter
in interface WalkerHandler
TopicMapProcessingException
public void onVariantName(VariantName varName) throws TopicMapProcessingException
onVariantName
in interface WalkerHandler
TopicMapProcessingException
public boolean startOccurrence(Occurrence occ) throws TopicMapProcessingException
startOccurrence
in interface WalkerHandler
TopicMapProcessingException
public void endOccurrence(Occurrence occ) throws TopicMapProcessingException
endOccurrence
in interface WalkerHandler
TopicMapProcessingException
public boolean startAssociation(Association assoc) throws TopicMapProcessingException
startAssociation
in interface WalkerHandler
TopicMapProcessingException
public void endAssociation(Association assoc) throws TopicMapProcessingException
endAssociation
in interface WalkerHandler
TopicMapProcessingException
public boolean startMember(Member m) throws TopicMapProcessingException
startMember
in interface WalkerHandler
TopicMapProcessingException
public void endMember(Member m) throws TopicMapProcessingException
endMember
in interface WalkerHandler
TopicMapProcessingException
public void onRoleSpec(Topic rs) throws TopicMapProcessingException
onRoleSpec
in interface WalkerHandler
TopicMapProcessingException
public void onPlayer(Topic p) throws TopicMapProcessingException
onPlayer
in interface WalkerHandler
TopicMapProcessingException
protected java.lang.String getID(TopicMap tm)
protected java.lang.String getResourceID(TopicMapObject tmo, Locator srcLoc)
tmo
's resourceLocator property if,
and only if the document part of the resourceLocator matches the doucment part
of the containing TopicMap object's resourceLocator property.
This method is used to roundtrip id attribute values which were read in from
an XTM file.
If a Topic object is passed to this method and it has a resourceLocator property with
a document part which does not match the document part of the containing TopicMap's
resourceLocator property, then this method will check all of the subjectIndicators of the
topic to see if there is one which does - in this case the fragment identifier of that subjectIndicator
is returned.
tmo
- the TopicMapObject to extract a resource ID from
tmo
or null
if either the object or its container
TopicMap does not have a resourceLocator specified or if the resourceLocator
of the object or the containing TopicMap is not a URILocator instance.protected java.lang.String getDocumentPart(java.lang.String addressString)
addressString
- the complete address string
protected java.lang.String getID(TopicMapObject tmo)
tmo
- the object to return the exported id attribute value for
protected void onScopedObject(java.lang.String soID)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |