Package net.ontopia.topicmaps.xml
Class XTMTopicMapReader
java.lang.Object
net.ontopia.xml.AbstractXMLFormatReader
net.ontopia.topicmaps.xml.XTMTopicMapReader
- All Implemented Interfaces:
TopicMapReaderIF
PUBLIC: A topic map reader that reads the XTM 1.0 interchange
syntax. A topic map is built as part of the import process. A
variety of possible input sources are accommodated, by overloading
the constructor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected ExternalReferenceHandlerIFprotected TopicMapStoreFactoryIFprotected Iteratorprotected booleanFields inherited from class net.ontopia.xml.AbstractXMLFormatReader
base_address, source -
Constructor Summary
ConstructorsConstructorDescriptionXTMTopicMapReader(File file) PUBLIC: Creates a topic map reader bound to the file given in the arguments.XTMTopicMapReader(InputStream stream, LocatorIF base_address) PUBLIC: Creates a topic map reader bound to the input stream given in the arguments.XTMTopicMapReader(Reader reader, LocatorIF base_address) PUBLIC: Creates a topic map reader bound to the reader given in the arguments.XTMTopicMapReader(URL url) PUBLIC: Creates a topic map reader bound to the URL given in the arguments.XTMTopicMapReader(URL url, LocatorIF base_address) XTMTopicMapReader(InputSource source, LocatorIF base_address) PUBLIC: Creates a topic map reader bound to the input source given in the arguments. -
Method Summary
Modifier and TypeMethodDescriptionPUBLIC: Gets the external reference handler.PUBLIC: Gets the store factory which will be used to create stores.booleanPUBLIC: Returns true if validation is on, false otherwise.voidimportInto(TopicMapIF topicmap) PUBLIC: Imports an implicitly designated topic map into the given topic map.read()PUBLIC: Reads the next topic map available from some implicit, implementation dependent source.protected TopicMapIFread(TopicMapStoreFactoryIF store_factory) readAll()PUBLIC: Reads all the topic map available from some implicit, implementation dependent source.protected CollectionreadAll(TopicMapStoreFactoryIF store_factory) voidsetAdditionalProperties(Map<String, Object> properties) Sets additional properties for the XTMTopicMapReader.voidsetExternalReferenceHandler(ExternalReferenceHandlerIF ref_handler) PUBLIC: Sets the external reference handler.voidsetFollowTopicRefs(boolean followTopicRefs) PUBLIC: If set to false topicRef elements pointing to external documents will not be traversed.voidsetStoreFactory(TopicMapStoreFactoryIF store_factory) PUBLIC: Sets the store factory which will be used to create stores.voidsetValidation(boolean validate) PUBLIC: Turn validation of XTM documents according to DTD on or off.Methods inherited from class net.ontopia.xml.AbstractXMLFormatReader
getBaseAddress, getInputSource, setBaseAddress, setInputSource
-
Field Details
-
PROPERTY_VALIDATION
- See Also:
-
PROPERTY_EXTERNAL_REFERENCE_HANDLER
- See Also:
-
topicmaps
-
store_factory
-
ref_handler
-
validate
protected boolean validate
-
-
Constructor Details
-
XTMTopicMapReader
PUBLIC: Creates a topic map reader bound to the URL given in the arguments.- Parameters:
url- The URL of the topic map document.- Throws:
MalformedURLException
-
XTMTopicMapReader
-
XTMTopicMapReader
PUBLIC: Creates a topic map reader bound to the reader given in the arguments.- Parameters:
reader- The reader from which the topic map is to be read.base_address- The base address to be used for resolving relative references.
-
XTMTopicMapReader
PUBLIC: Creates a topic map reader bound to the input stream given in the arguments.- Parameters:
stream- The input stream from which the topic map is to be read.base_address- The base address to be used for resolving relative references.
-
XTMTopicMapReader
PUBLIC: Creates a topic map reader bound to the file given in the arguments.- Parameters:
file- The file object from which to read the topic map.- Throws:
IOException
-
XTMTopicMapReader
PUBLIC: Creates a topic map reader bound to the input source given in the arguments.- Parameters:
source- The SAX input source from which the topic map is to be read.base_address- The base address to be used for resolving relative references.
-
-
Method Details
-
getStoreFactory
PUBLIC: Gets the store factory which will be used to create stores. -
setStoreFactory
PUBLIC: Sets the store factory which will be used to create stores.Default:
InMemoryStoreFactory- Parameters:
store_factory- The store factory to use. If the parameter is null the default store factory will be used.
-
getExternalReferenceHandler
PUBLIC: Gets the external reference handler. The reference handler will receive notifications on references to external topics and topic maps. -
setExternalReferenceHandler
PUBLIC: Sets the external reference handler. -
setFollowTopicRefs
public void setFollowTopicRefs(boolean followTopicRefs) PUBLIC: If set to false topicRef elements pointing to external documents will not be traversed. The default is that those the documents pointed to by those elements will be loaded (as per the XTM specification).- Since:
- 3.0
-
setValidation
public void setValidation(boolean validate) PUBLIC: Turn validation of XTM documents according to DTD on or off. The validation checks if the documents read follow the DTD, and will abort import if they do not.- Parameters:
validate- Will validate if true, will not if false.- Since:
- 2.0
-
getValidation
public boolean getValidation()PUBLIC: Returns true if validation is on, false otherwise.- Since:
- 2.0
-
read
Description copied from interface:TopicMapReaderIFPUBLIC: Reads the next topic map available from some implicit, implementation dependent source. A topic map source may contain multiple topic maps. The read method returns the next topic map that is available from that source.nullis returned when there are no more topic maps available. In a sense this is iterator-like behaviour.- Specified by:
readin interfaceTopicMapReaderIF- Returns:
- The next topic map read from the source; an object implementing TopicMapIF. null is returned when there are no more topic maps available from the source.
- Throws:
IOException- Thrown if reading the source fails.
-
read
- Throws:
IOException
-
readAll
Description copied from interface:TopicMapReaderIFPUBLIC: Reads all the topic map available from some implicit, implementation dependent source. A topic map source may contain multiple topic maps. The readAll method returns a collection contain all the topic maps available from the source.- Specified by:
readAllin interfaceTopicMapReaderIF- Returns:
- A collection containing all the topic maps read from the source; objects implementing TopicMapIF.
- Throws:
IOException- Thrown if reading the source fails.
-
readAll
- Throws:
IOException
-
importInto
Description copied from interface:TopicMapReaderIFPUBLIC: Imports an implicitly designated topic map into the given topic map.- Specified by:
importIntoin interfaceTopicMapReaderIF- Parameters:
topicmap- The topic map into which the import will be done; an object implementing TopicMapIF.- Throws:
IOException
-
setAdditionalProperties
Sets additional properties for the XTMTopicMapReader. Accepts properties 'validation' and 'externalReferenceHandler'. The value of 'validation' has to be a boolean and corresponds to thesetValidation(boolean)method. The value of 'externalReferenceHandler' has to be anExternalReferenceHandlerIFand corresponds to thesetExternalReferenceHandler(net.ontopia.topicmaps.xml.ExternalReferenceHandlerIF)method.- Specified by:
setAdditionalPropertiesin interfaceTopicMapReaderIF- Parameters:
properties-
-