com.thoughtworks.xstream.XStream.ignoreUnknownElements()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(308)

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

XStream.ignoreUnknownElements介绍

[英]Ignore all unknown elements.
[中]忽略所有未知元素。

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Ignore all unknown elements.
 *
 * @since 1.4.5
 */
public void ignoreUnknownElements() {
  ignoreUnknownElements(IGNORE_ALL);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Add pattern for unknown element names to ignore.
 *
 * @param pattern the name pattern as regular expression
 * @since 1.4.5
 */
public void ignoreUnknownElements(String pattern) {
  ignoreUnknownElements(Pattern.compile(pattern));
}

代码示例来源:origin: chanjarster/weixin-java-tools

public static XStream getInstance() {
 XStream xstream = new XStream(new XppDriver() {
  @Override
  public HierarchicalStreamWriter createWriter(Writer out) {
   return new PrettyPrintWriter(out, getNameCoder()) {
    protected String PREFIX_CDATA = "<![CDATA[";
    protected String SUFFIX_CDATA = "]]>";
    protected String PREFIX_MEDIA_ID = "<MediaId>";
    protected String SUFFIX_MEDIA_ID = "</MediaId>";
    @Override
    protected void writeText(QuickWriter writer, String text) {
     if (text.startsWith(PREFIX_CDATA) && text.endsWith(SUFFIX_CDATA)) {
      writer.write(text);
     } else if (text.startsWith(PREFIX_MEDIA_ID) && text.endsWith(SUFFIX_MEDIA_ID)) {
      writer.write(text);
     } else {
      super.writeText(writer, text);
     }
    }
   };
  }
 });
 xstream.ignoreUnknownElements();
 xstream.setMode(XStream.NO_REFERENCES);
 xstream.addPermission(NullPermission.NULL);
 xstream.addPermission(PrimitiveTypePermission.PRIMITIVES);
 return xstream;
}

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

xs.ignoreUnknownElements();

代码示例来源:origin: x-stream/xstream

/**
 * Ignore all unknown elements.
 *
 * @since 1.4.5
 */
public void ignoreUnknownElements() {
  ignoreUnknownElements(IGNORE_ALL);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

/**
 * Ignore all unknown elements.
 *
 * @since 1.4.5
 */
public void ignoreUnknownElements() {
  ignoreUnknownElements(IGNORE_ALL);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

/**
 * Ignore all unknown elements.
 *
 * @since 1.4.5
 */
public void ignoreUnknownElements() {
  ignoreUnknownElements(IGNORE_ALL);
}

代码示例来源:origin: org.sonatype.nexus.xstream/xstream

/**
 * Ignore all unknown elements.
 * 
 * @since 1.4.5
 */
public void ignoreUnknownElements() {
  ignoreUnknownElements(IGNORE_ALL);
}

代码示例来源:origin: x-stream/xstream

/**
 * Add pattern for unknown element names to ignore.
 *
 * @param pattern the name pattern as regular expression
 * @since 1.4.5
 */
public void ignoreUnknownElements(final String pattern) {
  ignoreUnknownElements(Pattern.compile(pattern));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

/**
 * Add pattern for unknown element names to ignore.
 *
 * @param pattern the name pattern as regular expression
 * @since 1.4.5
 */
public void ignoreUnknownElements(String pattern) {
  ignoreUnknownElements(Pattern.compile(pattern));
}

代码示例来源:origin: boyuanitsm/pay

public static Object getObjectFromXML(String xml, Class tClass) {
  //将从API返回的XML数据映射到Java对象
  XStream xStreamForResponseData = new XStream();
  xStreamForResponseData.alias("xml", tClass);
  xStreamForResponseData.ignoreUnknownElements();//暂时忽略掉一些新增的字段
  return xStreamForResponseData.fromXML(xml);
}

代码示例来源:origin: boyuanitsm/pay

public static Object getObjectFromXML(String xml, Class tClass) {
  //将从API返回的XML数据映射到Java对象
  XStream xStreamForResponseData = new XStream();
  xStreamForResponseData.alias("xml", tClass);
  xStreamForResponseData.ignoreUnknownElements();//暂时忽略掉一些新增的字段
  return xStreamForResponseData.fromXML(xml);
}

代码示例来源:origin: org.jbehave/jbehave-rest

protected XStream configureXStream() {
  XStream stream = new XStream();
  stream.addImplicitCollection(Page.class, "link");
  stream.alias("results", Results.class);
  stream.alias("result", Page.class);
  stream.alias("content", Page.class);
  stream.alias("link", Link.class);
  stream.useAttributeFor(Link.class, "rel");
  stream.useAttributeFor(Link.class, "href");
  stream.ignoreUnknownElements();
  return stream;
}

代码示例来源:origin: groupon/DotCi

@PrePersist
void saveState(final DBObject dbObj) {
  dbObj.put("state", getState().toString());
  hudson.model.Items.XSTREAM.ignoreUnknownElements();
}

代码示例来源:origin: org.eclipse.smarthome.extensionservice/org.eclipse.smarthome.extensionservice.marketplace

@Override
public void registerAliases(XStream xstream) {
  xstream.alias("marketplace", Marketplace.class);
  xstream.addImplicitArray(Marketplace.class, "categories");
  xstream.alias("category", Category.class);
  xstream.addImplicitArray(Category.class, "nodes");
  xstream.alias("node", Node.class);
  xstream.aliasAttribute(Node.class, "id", "id");
  xstream.aliasAttribute(Node.class, "name", "name");
  // ignore what we do not know
  xstream.ignoreUnknownElements();
}

代码示例来源:origin: openl-tablets/openl-tablets

public XmlRulesDescriptorSerializer_v5_11() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_11.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_11.class);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

public XmlRulesDescriptorSerializer_v5_11() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_11.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_11.class);
  }
}

代码示例来源:origin: openl-tablets/openl-tablets

public XmlRulesDescriptorSerializer_v5_14() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_14.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType("publisher", RulesDeploy_v5_14.PublisherType.class);
    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_14.class);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

public XmlRulesDescriptorSerializer_v5_14() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_14.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType("publisher", RulesDeploy_v5_14.PublisherType.class);
    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_14.class);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.webstudio

public XmlRulesDescriptorSerializer_v5_16() {
    super(new RulesDeployVersionConverter());
    xstream.ignoreUnknownElements();
    xstream.omitField(RulesDeploy_v5_16.class, "log");

    xstream.setMode(XStream.NO_REFERENCES);

    xstream.aliasType("publisher", RulesDeploy_v5_16.PublisherType.class);
    xstream.aliasType(RULES_DEPLOY_DESCRIPTOR_TAG, RulesDeploy_v5_16.class);
    xstream.aliasType(MODULE_NAME, RulesDeploy_v5_16.WildcardPattern.class);

    xstream.aliasField(LAZY_MODULES_FOR_COMPILATION, RulesDeploy_v5_16.class, "lazyModulesForCompilationPatterns");

    xstream.aliasField("name", RulesDeploy_v5_16.WildcardPattern.class, "value");
    xstream.useAttributeFor(RulesDeploy_v5_16.WildcardPattern.class, "value");
  }
}

相关文章