• 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));
  • 相关阅读:
    Core上传图片
    Pytho学习(3)——注释
    zabbix实操随笔
    1900型USB接口扫描枪设置虚拟串口模式提升扫描速度
    SQLServer设置单用户
    入门安装环境
    centos下载
    java学习资料
    错误模块名称: KERNELBASE.dll
    iis部署WebService出现"因 URL 意外地以 结束,请求格式无法识别"的解决方法
  • 原文地址:https://www.cnblogs.com/otways/p/11158753.html
Copyright © 2020-2023  润新知