当前位置: 首页>>代码示例>>Java>>正文


Java XStream.ignoreUnknownElements方法代码示例

本文整理汇总了Java中com.thoughtworks.xstream.XStream.ignoreUnknownElements方法的典型用法代码示例。如果您正苦于以下问题:Java XStream.ignoreUnknownElements方法的具体用法?Java XStream.ignoreUnknownElements怎么用?Java XStream.ignoreUnknownElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thoughtworks.xstream.XStream的用法示例。


在下文中一共展示了XStream.ignoreUnknownElements方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toPojo

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public static GerarNFSeResposta toPojo(String xml) {
  XStream xstream = new XStream();
  xstream.setMode(XStream.NO_REFERENCES);
  xstream.autodetectAnnotations(true);
  xstream.ignoreUnknownElements();
  xstream.alias("GerarNfseResposta", GerarNFSeResposta.class);
  xstream.alias("Nfse", NFSe.class);
  GerarNFSeResposta gerarNfseResposta = (GerarNFSeResposta) xstream.fromXML(xml);
  return gerarNfseResposta;
}
 
开发者ID:pablopdomingos,项目名称:nfse,代码行数:11,代码来源:GerarNFSeResposta.java

示例2: toPojo

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public static ConsultarLoteRpsResposta toPojo(String xml) {
  XStream xstream = new XStream();
  xstream.setMode(XStream.NO_REFERENCES);
  xstream.autodetectAnnotations(true);
  xstream.ignoreUnknownElements();
  xstream.alias("ConsultarLoteRpsResposta", ConsultarLoteRpsResposta.class);
  xstream.alias("Nfse", Nfse.class);
  ConsultarLoteRpsResposta gerarNfseResposta = (ConsultarLoteRpsResposta) xstream.fromXML(xml);
  return gerarNfseResposta;
}
 
开发者ID:pablopdomingos,项目名称:nfse,代码行数:11,代码来源:ConsultarLoteRpsResposta.java

示例3: toPojo

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public static EnviarLoteRpsResposta toPojo(String xml) {
  XStream xstream = new XStream();
  xstream.setMode(XStream.NO_REFERENCES);
  xstream.autodetectAnnotations(true);
  xstream.ignoreUnknownElements();
  xstream.alias("EnviarLoteRpsResposta", EnviarLoteRpsResposta.class);
  EnviarLoteRpsResposta enviarLoteRpsResposta = (EnviarLoteRpsResposta) xstream.fromXML(xml);
  return enviarLoteRpsResposta;
}
 
开发者ID:pablopdomingos,项目名称:nfse,代码行数:10,代码来源:EnviarLoteRpsResposta.java

示例4: toPojo

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
public static CompNFSe toPojo(String xml) {
  XStream xstream = new XStream();
  xstream.setMode(XStream.NO_REFERENCES);
  xstream.autodetectAnnotations(true);
  xstream.ignoreUnknownElements();
  xstream.alias("CompNfse", CompNFSe.class);
  xstream.alias("Nfse", NFSe.class);
  CompNFSe compNfse = (CompNFSe) xstream.fromXML(xml);
  return compNfse;
}
 
开发者ID:pablopdomingos,项目名称:nfse,代码行数:11,代码来源:CompNFSe.java

示例5: getXML

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
/**
 * transforms user into XML string
 *
 * @param user
 * @return
 */
private String getXML (Type toWrite) {
    XStream xstream = new XStream(new DomDriver());
    xstream.ignoreUnknownElements();
    xstream.processAnnotations(SocialProfile.class);
    return xstream.toXML(toWrite);
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:13,代码来源:XStreamWriter.java

示例6: getInstance

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
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(this.PREFIX_CDATA) && text.endsWith(this.SUFFIX_CDATA)) {
            writer.write(text);
          } else if (text.startsWith(this.PREFIX_MEDIA_ID) && text.endsWith(this.SUFFIX_MEDIA_ID)) {
            writer.write(text);
          } else {
            super.writeText(writer, text);
          }

        }

        @Override
        public String encodeNode(String name) {
          return name;//防止将_转换成__
        }
      };
    }
  });
  xstream.ignoreUnknownElements();
  xstream.setMode(XStream.NO_REFERENCES);
  xstream.addPermission(NullPermission.NULL);
  xstream.addPermission(PrimitiveTypePermission.PRIMITIVES);
  return xstream;
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:37,代码来源:XStreamInitializer.java

示例7: getObjectFromXML

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
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);
}
 
开发者ID:rongwei84n,项目名称:Auts_Assert_manager,代码行数:8,代码来源:Util.java

示例8: getObjectFromXML

import com.thoughtworks.xstream.XStream; //导入方法依赖的package包/类
/**
 * 从xml里获取对象
 *
 * @param xml
 * @param tClass
 * @return
 */
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);
}
 
开发者ID:fanqinghui,项目名称:wish-pay,代码行数:15,代码来源:WxUtils.java


注:本文中的com.thoughtworks.xstream.XStream.ignoreUnknownElements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。