TMXMLReader extends AbstractXMLFormatReader implements TopicMapReaderIF { @Override public TopicMapIF read() throws IOException { InMemoryTopicMapStore store = new InMemoryTopicMapStore(); store.setBaseAddress(base_address); TopicMapIF topicmap = store.getTopicMap(); importInto(topicmap); ClassInstanceUtils.resolveAssociations1(topicmap); ClassInstanceUtils.resolveAssociations2(topicmap); return topicmap; } TMXMLReader(URL url);  TMXMLReader(URL url, LocatorIF base_address);  TMXMLReader(File file);  TMXMLReader(Reader reader, LocatorIF base_address);  TMXMLReader(InputStream stream, LocatorIF base_address);  TMXMLReader(InputSource source, LocatorIF base); boolean getValidate(); void setValidate(boolean validate); @Override TopicMapIF read(); @Override void importInto(TopicMapIF topicmap); @Override Collection readAll(); @Override void setAdditionalProperties(Map<String, Object> properties); static final String PROPERTY_VALIDATE; }
@Test public void testReadFromURL() throws IOException { TopicMapIF tm = new TMXMLReader(TestFileUtils.getTestInputURL("tmxml", "in", "empty-topic.xml")).read(); Assert.assertNotNull(tm); Assert.assertEquals(2, tm.getTopics().size()); }
@Test public void testReadFromFile() throws IOException { TopicMapIF tm = new TMXMLReader(TestFileUtils.getTransferredTestInputFile("tmxml", "in", "empty-topic.xml")).read(); Assert.assertNotNull(tm); Assert.assertEquals(2, tm.getTopics().size()); }
@Test public void testReadFromInputStream() throws IOException { File file = TestFileUtils.getTransferredTestInputFile("tmxml", "in", "empty-topic.xml"); TopicMapIF tm = new TMXMLReader(new FileInputStream(file), new URILocator(file)).read(); Assert.assertNotNull(tm); Assert.assertEquals(2, tm.getTopics().size()); }
@Test public void testReadFromReader() throws IOException { File file = TestFileUtils.getTransferredTestInputFile("tmxml", "in", "empty-topic.xml"); TopicMapIF tm = new TMXMLReader(new FileReader(file), new URILocator(file)).read(); Assert.assertNotNull(tm); Assert.assertEquals(2, tm.getTopics().size()); }
@Test public void testReadFromInputSource() throws IOException { File file = TestFileUtils.getTransferredTestInputFile("tmxml", "in", "empty-topic.xml"); TopicMapIF tm = new TMXMLReader(new InputSource(new FileReader(file)), new URILocator(file)).read(); Assert.assertNotNull(tm); Assert.assertEquals(2, tm.getTopics().size()); }