Package net.ontopia.topicmaps.xml
Class XTMContentHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
net.ontopia.topicmaps.xml.AbstractTopicMapContentHandler
net.ontopia.topicmaps.xml.XTMContentHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler,DeclHandler,LexicalHandler
public class XTMContentHandler
extends AbstractTopicMapContentHandler
implements LexicalHandler, DeclHandler
INTERNAL: SAX2 content handler used for importing XTM 1.0 topic map
documents. The content handler builds a topic map object based on a
SAX event stream conforming to the XTM topic map interchange
syntax. See http://www.topicmaps.org/xtm/1.0/
-
Field Summary
FieldsModifier and TypeFieldDescriptionKeeps track of the declared entities, in order that the base URI can be set correctly in external entities.protected booleanUsed to tell if we are reading the top-level XTM document (false) or if we are reading a merged-in XTM document (true).static final Stringstatic final Stringstatic final Stringstatic final LocatorIFprotected ExternalReferenceHandlerIFstatic final Stringstatic final Stringprotected TopicMapStoreFactoryIFFields inherited from class net.ontopia.topicmaps.xml.AbstractTopicMapContentHandler
doc_address, ehandler, info, locator, parents, processed_documents_accumulated, processed_documents_current, processed_documents_from_parent, propagated_themes -
Constructor Summary
ConstructorsConstructorDescriptionXTMContentHandler(TopicMapStoreFactoryIF stores, LocatorIF base_address) XTMContentHandler(TopicMapStoreFactoryIF stores, LocatorIF base_address, Collection<LocatorIF> processed_documents) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddItemIdentifier(TMObjectIF tmobject, LocatorIF sourceLocator) protected TopicIFaddSubjectIdentifier(TopicIF topic, LocatorIF subjectIndicator) voidvoidcharacters(char[] ch, int start, int length) voidcomment(char[] ch, int start, int length) protected LocatorIFcreateLocator(String address) protected TopicIFprotected LocatorIFcreateURILocator(String address) voidelementDecl(String name, String model) voidendCDATA()voidvoidendDTD()voidendElement(String uri, String name, String qName) voidvoidendPrefixMapping(String prefix) voidexternalEntityDecl(String name, String publicId, String systemId) protected LocatorIFstatic TopicIFgetDefaultOccurrenceTopic(TopicMapIF topicmap) INTERNAL: Gets the external reference handler.static TopicIFgetNullTopic(TopicMapIF topicmap) protected TopicIFprotected TopicIFgetReferencedExternalTopic(LocatorIF orig_locator) INTERNAL: Gets the topic maps found after having parsed the input source.voidinternalEntityDecl(String name, String value) protected voidprocessMember(TopicIF player) protected voidprocessTheme(TopicIF theme) protected voidprocessTopicReference(TopicIF referenced_topic) voidINTERNAL: Registers the handler with the parser and configures the parser.protected voidregisterSourceLocator(TMObjectIF tmobject, String id) protected TopicIFregisterSourceLocator(TopicIF topic, LocatorIF locator) protected TopicIFregisterSubjectIndicator(TopicIF topic, LocatorIF locator) protected TopicIFregisterSubjectLocator(TopicIF topic, LocatorIF locator) static voidremoveDefaultOccurrenceTopic(TopicMapIF topicmap) static voidremoveNullTopic(TopicMapIF topicmap) protected TopicIFresolveResourceRef(LocatorIF locator) protected TopicIFprotected TopicIFresolveTopicRef(String address) voidsetExternalReferenceHandler(ExternalReferenceHandlerIF ref_handler) INTERNAL: Sets the external reference handler.voidsetSubDocument(boolean isSubDocument) INTERNAL: Tell the handler whether this is a top-level document or not.voidvoidvoidvoidstartElement(String uri, String name, String qName, Attributes atts) voidstartEntity(String name) voidstartPrefixMapping(String prefix, String uri) Methods inherited from class net.ontopia.topicmaps.xml.AbstractTopicMapContentHandler
getDefaultErrorHandler, getLocationInfo, getPropagatedThemes, propagateThemes, setDocumentLocator, setPropagatedThemesMethods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
NS_XTM
- See Also:
-
NS_XLINK
- See Also:
-
NS_NS
- See Also:
-
nullPSI
-
SAX_LEXICAL_HANDLER
- See Also:
-
SAX_DECL_HANDLER
- See Also:
-
stores
-
entities
Keeps track of the declared entities, in order that the base URI can be set correctly in external entities. -
isSubDocument
protected boolean isSubDocumentUsed to tell if we are reading the top-level XTM document (false) or if we are reading a merged-in XTM document (true). -
ref_handler
-
-
Constructor Details
-
XTMContentHandler
-
XTMContentHandler
public XTMContentHandler(TopicMapStoreFactoryIF stores, LocatorIF base_address, Collection<LocatorIF> processed_documents)
-
-
Method Details
-
getTopicMaps
INTERNAL: Gets the topic maps found after having parsed the input source. -
getExternalReferenceHandler
INTERNAL: Gets the external reference handler. The reference handler will receive notifications on references to external topics and topic maps. -
setExternalReferenceHandler
INTERNAL: Sets the external reference handler. -
setSubDocument
public void setSubDocument(boolean isSubDocument) INTERNAL: Tell the handler whether this is a top-level document or not. -
register
INTERNAL: Registers the handler with the parser and configures the parser.- Overrides:
registerin classAbstractTopicMapContentHandler
-
startDocument
public void startDocument()- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler
-
endDocument
public void endDocument()- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler
-
startElement
public void startElement(String uri, String name, String qName, Attributes atts) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
characters
public void characters(char[] ch, int start, int length) - Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
startPrefixMapping
- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classDefaultHandler
-
endPrefixMapping
- Specified by:
endPrefixMappingin interfaceContentHandler- Overrides:
endPrefixMappingin classDefaultHandler
-
getBaseAddress
-
resolveTopicRef
- Throws:
SAXException
-
resolveResourceRef
-
registerSubjectLocator
-
registerSourceLocator
-
registerSourceLocator
-
registerSubjectIndicator
-
resolveSourceLocatorOrSubjectIndicator
-
createLocator
-
createURILocator
-
getReferencedExternalTopic
- Throws:
SAXException
-
processTheme
-
processTopicReference
-
processMember
-
addItemIdentifier
-
addSubjectIdentifier
-
getParentTopic
-
createTopicFromLazyTopic
-
startEntity
- Specified by:
startEntityin interfaceLexicalHandler
-
endEntity
- Specified by:
endEntityin interfaceLexicalHandler
-
comment
public void comment(char[] ch, int start, int length) - Specified by:
commentin interfaceLexicalHandler
-
startCDATA
public void startCDATA()- Specified by:
startCDATAin interfaceLexicalHandler
-
endCDATA
public void endCDATA()- Specified by:
endCDATAin interfaceLexicalHandler
-
startDTD
- Specified by:
startDTDin interfaceLexicalHandler
-
endDTD
public void endDTD()- Specified by:
endDTDin interfaceLexicalHandler
-
externalEntityDecl
- Specified by:
externalEntityDeclin interfaceDeclHandler
-
attributeDecl
- Specified by:
attributeDeclin interfaceDeclHandler
-
elementDecl
- Specified by:
elementDeclin interfaceDeclHandler
-
internalEntityDecl
- Specified by:
internalEntityDeclin interfaceDeclHandler
-
getNullTopic
-
getDefaultOccurrenceTopic
-
removeNullTopic
-
removeDefaultOccurrenceTopic
-