zoukankan      html  css  js  c++  java
  • XML报文拼接 乱码

    以下直接上源码:

    /*Element root = doc.getRootElement();
            Element ACCOUNTLISTElement = new Element("ACCOUNTLIST");
            Element ACCOUNTElement = new Element("ACCOUNT");
    
            String mobile = autoRegistVo.getMOBILE();
    
            Element ACCOUNTNAMEElement = new Element("ACCOUNTNAME");
            ACCOUNTNAMEElement.addContent(mobile);
            ACCOUNTElement.addContent(ACCOUNTNAMEElement);
    
            Element ACCOUNTPWDElement = new Element("ACCOUNTPWD");
    //        ACCOUNTPWDElement.addContent(" ");
            ACCOUNTElement.addContent(ACCOUNTPWDElement);
    
            Element ACCOUNTTYPEElement = new Element("ACCOUNTTYPE");
    //        ACCOUNTTYPEElement.addContent(" ");
            ACCOUNTElement.addContent(ACCOUNTTYPEElement);
    
            Element AGENTIDElement = new Element("AGENTID");
            OfficeAccountEntity officeAccount = super.findOfficeAccount(mobile);
            if (officeAccount != null) {
                AGENTIDElement.addContent(officeAccount.getOfficeId());
            }
            ACCOUNTElement.addContent(AGENTIDElement);
    
            Element ISAUTOREGISTElement = new Element("ISAUTOREGIST");
    //        ISAUTOREGISTElement.addContent(" ");
            ACCOUNTElement.addContent(ISAUTOREGISTElement);
    
            Element FIRSTLOGINTIMEElement = new Element("FIRSTLOGINTIME");
    //        FIRSTLOGINTIMEElement.addContent(" ");
            ACCOUNTElement.addContent(FIRSTLOGINTIMEElement);
    
            Element FIRSTLOGINTYPEElement = new Element("FIRSTLOGINTYPE");
    //        FIRSTLOGINTYPEElement.addContent("");
            ACCOUNTElement.addContent(FIRSTLOGINTYPEElement);
    
            Element ISBINDPOLICYElement = new Element("ISBINDPOLICY");
    //        ISBINDPOLICYElement.addContent(" ");
            ACCOUNTElement.addContent(ISBINDPOLICYElement);
    
            ACCOUNTLISTElement.addContent(ACCOUNTElement);
            root.addContent(ACCOUNTLISTElement);
    
            String xmlStr = "";
            try {
                org.jdom2.output.Format format = org.jdom2.output.Format.getCompactFormat();
                format.setEncoding("UTF-8");// 设置xml文件的字符为UTF-8,解决中文问题
    
                XMLOutputter xmlout = new XMLOutputter(format);
    
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
                xmlout.output(doc, bo);
                xmlStr = new String(bo.getByteArray(),"UTF-8")
           //xmlStr = bo.toString(); } catch (Exception e) { logger.error("补充认证中心xml结果失败"); } return xmlStr;
    */ //return JsonUtils.transferToJson(convertRegistFileToXml(registAccountExeitModel));
  • 相关阅读:
    Python PEP8 编码规范中文版
    MySQL分区表
    mybatis缓存,包含一级缓存与二级缓存,包括ehcache二级缓存
    斐讯K2刷不死breed与第三方固件教程
    Mysql 多表连接查询 inner join 和 outer join 的使用
    mysql多表关联删除示例
    sublime Text 几款插件
    多进程vs多线程
    git 命令常用总结
    LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
  • 原文地址:https://www.cnblogs.com/otways/p/11158753.html
Copyright © 2011-2022 走看看