gpt4 book ai didi

net.ontopia.topicmaps.xml.XTMTopicMapWriter.setVersion()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 04:10:40 24 4
gpt4 key购买 nike

本文整理了Java中net.ontopia.topicmaps.xml.XTMTopicMapWriter.setVersion()方法的一些代码示例,展示了XTMTopicMapWriter.setVersion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XTMTopicMapWriter.setVersion()方法的具体详情如下:
包路径:net.ontopia.topicmaps.xml.XTMTopicMapWriter
类名称:XTMTopicMapWriter
方法名:setVersion

XTMTopicMapWriter.setVersion介绍

[英]PUBLIC: Set XTM version to use on export.
[中]PUBLIC:将XTM版本设置为在导出时使用。

代码示例

代码示例来源:origin: ontopia/ontopia

setVersion((XTMVersion) value);

代码示例来源:origin: ontopia/ontopia

protected void export() throws IOException {
 XTMTopicMapWriter writer = new XTMTopicMapWriter(tmfile);
 writer.setVersion(version);
 writer.setAddIds(true);
 writer.write(topicmap);
}

代码示例来源:origin: ontopia/ontopia

@Override
  protected void writeFragment(OutputStream outputStream, Object source, CharacterSet characterSet)  throws IOException {
    if (source instanceof TopicMapIF) {
      XTMTopicMapWriter writer = new XTMTopicMapWriter(outputStream, characterSet.getName()); 
      writer.setVersion(XTMVersion.XTM_2_1); // todo: config
      writer.write((TopicMapIF) source);
    } 
    if (source instanceof TopicIF) {
      XTMTopicMapFragmentWriter writer = new XTMTopicMapFragmentWriter(outputStream, characterSet.getName());
      writer.startTopicMap();
      writer.exportTopic((TopicIF) source);
      writer.endTopicMap();
    }
    
    // todo: can source be any other class here?
  }
}

代码示例来源:origin: ontopia/ontopia

if (filter != null)
  filterer.setFilter(decider);
 filterer.setVersion(XTMVersion.XTM_1_0);
 writer = filterer;
} else if (format.equalsIgnoreCase("xtm2")) {

代码示例来源:origin: net.ontopia/ontopoly-editor

if (filter != null)
  filterer.setFilter(decider);
 filterer.setVersion(XTMVersion.XTM_1_0);
 writer = filterer;
} else if (format.equalsIgnoreCase("xtm2")) {

代码示例来源:origin: ontopia/ontopia

@Test
public void testEncoding2() throws IOException {
 TopicMapIF tm = load(testdataDirectory, "in", "latin1.xtm");
 File out = TestFileUtils.getTestOutputFile(testdataDirectory, "out", "tmp-utf-8.xtm");
 XTMTopicMapWriter writer = new XTMTopicMapWriter(out);
 writer.setVersion(XTMVersion.XTM_1_0);
 writer.write(tm);
 TopicMapIF tm2 = new XTMTopicMapReader(out).read();
 // check for a topic that has at least one name
 for (Object obj : tm2.getTopics()) {
  Collection<TopicNameIF> names = ((TopicIF) obj).getTopicNames();
  if (names != null && names.size() > 0) {
   TopicNameIF bn = names.iterator().next();
   Assert.assertTrue("base name value did not survive encoding change roundtrip",
     bn.getValue().equals("B\u00E6 b\u00E6 lille lam, har du noe \u00F8l"));
  }
 }
}

代码示例来源:origin: ontopia/ontopia

@Test
public void testEncoding() throws IOException {
 TopicMapIF tm = load(testdataDirectory, "in", "latin1.xtm");
 File out = TestFileUtils.getTestOutputFile(testdataDirectory, "out", "tmp-latin1.xtm");
 XTMTopicMapWriter writer = new XTMTopicMapWriter(out, "iso-8859-1");
 writer.setVersion(XTMVersion.XTM_1_0);
 writer.write(tm);
 TopicMapIF tm2 = new XTMTopicMapReader(out).read();
 // check for a topic that has at least one name
 for (Object obj : tm2.getTopics()) {
  Collection<TopicNameIF> names = ((TopicIF) obj).getTopicNames();
  if (names != null && names.size() > 0) {
   TopicNameIF bn = names.iterator().next();
   Assert.assertTrue("base name value did not survive encoding change roundtrip",
       bn.getValue().equals("B\u00E6 b\u00E6 lille lam, har du noe \u00F8l"));
  }
 }
}

代码示例来源:origin: ontopia/ontopia

@Override
 protected TopicMapIF exportAndReread(TopicMapIF topicmap, File outfile)
  throws IOException {
  // First we export
  XTMTopicMapWriter writer = new XTMTopicMapWriter(outfile);
  writer.setVersion(XTMVersion.XTM_1_0);
  writer.write(topicmap);

  // Then we read back in
  TopicMapIF topicmap2 = getStoreFactory().createStore().getTopicMap();
  XTMTopicMapReader reader = new XTMTopicMapReader(outfile);
  reader.setValidation(false);
  reader.importInto(topicmap2);

  return topicmap2;
 }
}

代码示例来源:origin: ontopia/ontopia

writer.setVersion(XTMVersion.XTM_1_0);
writer.write(tm);
tm.getStore().close();

代码示例来源:origin: ontopia/ontopia

writer.setVersion(XTMVersion.XTM_2_0);

代码示例来源:origin: ontopia/ontopia

writer.setVersion(XTMVersion.XTM_2_1);

代码示例来源:origin: ontopia/ontopia

xtmWriter.setVersion(XTMVersion.XTM_1_0);

代码示例来源:origin: ontopia/ontopia

@Test
public void testExportItemIdentifiers() throws IOException, SAXException {
 prepareTopicMap();
 TopicIF topic = builder.makeTopic();
 LocatorIF iid = tmbase.resolveAbsolute("#id4314");
 topic.addItemIdentifier(iid);
 // export to file (not using export() because we need to control settings)
 XTMTopicMapWriter writer = new XTMTopicMapWriter(tmfile);
 writer.setVersion(version);
 writer.setAddIds(true);
 writer.setExportSourceLocators(false);
 writer.write(topicmap);
 // reread file with SAX
 SearchAttributeValue handler =
  new SearchAttributeValue("itemIdentity", "href", iid.getAddress(),
               SearchAttributeValue.FORBIDDEN, false);
 parseFile(handler);
 handler.check();
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com