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));
  • 相关阅读:
    codeforces 1251 F. Red-White Fence
    NTT 模板
    快速傅里叶变换模板
    codeforces 1251E (贪心)
    平衡树
    lucas定理
    P3709 大爷的字符串题 (莫队)
    洛谷 P3258 [JLOI2014]松鼠的新家 (树链剖分或树上差分)
    算法-图(5)深度优先遍历图
    计算机网络-链路层(3)交换局域网
  • 原文地址:https://www.cnblogs.com/otways/p/11158753.html
Copyright © 2011-2022 走看看