當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。