将Map中的参数封装为XML
public String packageYDImageUploadXML(String versionCode, Map parmsMap) throws ParseException {
Document document = DocumentHelper.createDocument();
document.setXMLEncoding("UTF-8");
Element root = document.addElement("scybinput"); //root node
try {
//inidentity node
Element inidentity = root.addElement("inidentity");
//inidentity content
inidentity.addElement("version").addText(versionCode);
inidentity.addElement("baa008").addText(SettingUtil.getValue(Setting.Key.YB_TCQ_CODE));
inidentity.addElement("baa010").addText(SettingUtil.getValue(Setting.Key.YB_JYD_CODE));
inidentity.addElement("akb020").addText(SettingUtil.getValue(Setting.Key.YB_HOSPITAL_CODE));
inidentity.addElement("akb021").addText(SettingUtil.getValue(Setting.Key.COMMON_HOSPITAL_NAME));
//inbusinesscontent node
Element inbusinesscontent = root.addElement("inbusinesscontent");
//inbusinesscontent content
Iterator iterator = parmsMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next();
if (entry.getValue() != null) {
inbusinesscontent.addElement(entry.getKey()).addText(String.valueOf(entry.getValue()));
}else {
inbusinesscontent.addElement(entry.getKey());
}
}
}catch (Exception e){
getLogger().error("系统异常",e);
}finally {
return document.asXML(); //inputXml
}
}
将Map中的参数提取出来,通过Docment封装为XML.
将Map中的参数封装为XML的更多相关文章
- 通过反射将request中的参数封装到对象中
import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.text.SimpleDateFo ...
- (八)Struts2中的参数封装
一.静态参数封装 什么是静态参数? 静态参数就是硬编码的,不可随意改变. 例子: (1)我们首先创建一个Action类,里面有两个参数,用来封装请求参数 public class User exten ...
- Struts2把数据封装到集合中之封装到map中
struts框架封装数据可以封装到集合中也可以封装到map中,该篇博客主要讲解将数据封装到map中. 1. 封装复杂类型的参数(集合类型 Collection .Map接口等) 2. 需求:页面中有可 ...
- mybatis :xml文件中传入参数和if标签结合使用时要点
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti ...
- Ibatis中sqlmap参数map中还需要套list的情况如何写?
原始需求: 有若干个参数,需要作为ibatis拼装sql的参数传入,但是有个参数的值比较特殊,是若干种枚举值.具体到这个case,就是有有限个namespace.我每次需要通过传入多个namespac ...
- mybatis传入map参数,map中包含list(输入参数)
1.xml中配置: <!-- 根据条件查询满足条件的ID集合开始 --> <select id="getQuestionsIdsForExamPaper" res ...
- 3. 如何封装查询条件与查询结果到map中
public Map<String, Object> queryOrderStatus(String orderNo) { // 查询到的结果与查询的条件一一对应,封装到map中! Str ...
- 对象属性封装到map中
import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.lang.reflect.Modi ...
- 将应用程序中的一些参数写到xml配置文件中
最近碰到一个问题,需要将程序中的一些基本参数写到xml文件中,虽然网上有好多现成的代码,但是觉得对xml不熟悉,果断就研究了一下.先说一下大体思路吧,我设计了一个用来读取和回填的类,然后定义了一个接口 ...
随机推荐
- 为vue添加公用方法,vue添加通用方法
common.js var common =function() { return{ f1:function(){ console.log("this is common f1().&quo ...
- express session 和 socketio session关联
express session http是没有状态的协议, 需要web框架自己实现会话和会话管理工作. express框架有session插件可以使用. 见如下介绍: https://www.tuto ...
- 新装的SSMS一打开就显示VS许可证过期,但VS又运行正常,解决方法。
1.出现问题如下图: 2.解决方法 打开控制面板->程序卸载->找到Microsoft Visual Studio *** Shell(****),右击-修复. 3.修复好了,然后重启电脑 ...
- shell 脚本实现定时备份mysql数据库
首先要知道直接在脚本中输入mysql的密码是不被允许的,但是我们可以曲线救国 1. 在新建一个文件专门用来存储用户密码 如: vim ./.mysql.conf [mysqldump] user=yo ...
- 看不到git远程分支
1.先用fetch命令更新remote索引 $ git fetch 2.再查看remote分支,发现已经可以看到目标分支 $ git branch -a 3.再切换分支 $ git checkout ...
- Ajax数据爬取
Ajax的基本原理 以菜鸟教程的代码为例: XMLHTTPRequest对象是JS对Ajax的底层实现: var xmlhttp; if (window.XMLHttpRequest) { // IE ...
- Moment.js简单使用
1.设置语言环境,如设置中文环境: moment.locale("zh-cn"); 2.当前时间.指定时间: // 假设当前时间为:2018年12月10日 moment(); // ...
- spring boot集成swagger,自定义注解,拦截器,xss过滤,异步调用,guava限流,定时任务案例, 发邮件
本文介绍spring boot集成swagger,自定义注解,拦截器,xss过滤,异步调用,定时任务案例 集成swagger--对于做前后端分离的项目,后端只需要提供接口访问,swagger提供了接口 ...
- CSScript 使用纪要
CSScript 运行C#脚本的开源项目,在笔者简要使用过程中,遇到了一些问题,现简单记录. 1. CS0433 使用非基本类型 当遇到 CS0433错误,提示 type is defined mul ...
- Option path is not valid. Please refer to the README.
使用pomelo创建的项目并且安装依赖项目之后启动项目如出现如下错误提示 [2018-12-18 11:23:16.161] [ERROR] console - Option path is not ...