xml解析 - Java / Web 开发
<?xml version="1.0" encoding="UTF-8"?>
<action>
<model name="listuser">
<first>wang</first>
<last>laohu</last>
<age>25</age>
<version>中国邮电出版社</version>
</model>
<model name="user">
<first>zhang</first>
<last>li</last>
<age>25</age>
<version>中国邮电出版社</version>
</model>
</action>
现在有这个xml文件,我想把所有要用到的值都存在xml中,根节点和model名称是不要变的,现在主要就是要根据model中配置的name属性将其下的与此name名称相同的所有属性值都保存到map中,以后直接通过传递的name的名称获取该map对象,再由map中属性名称取到与之对应的属性值。
请问一下:这个该怎么实现 啊?
是用org.w3c.dom进行解析的
这是代码,但是不能获取name的属性值
public class ReadXml {
Map map = new HashMap();
private Document doc = null;
/**
*此方法包含两个参数,xmlFile表示的是需要解析的xml文件名 value表示父节点名,以后可以表示功能模块的模块编号
*
* @param xmlFile
* String
* @param value
* String
* @return Map
*/
public Map viewXML(String xmlFile, String value) throws Exception {
try{
相关问答:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 52 in the jsp file: /vip_info.jsp
ÕË cannot be resolved
49: <table border="1& ......
我是个新手,望高手解答
我现在已经安装了mysql,也有mysql的jdbc。但我怎么配置后,才能在MyEclipse里操作mysql呢?请高手说详细点
打开Myeclipse----window---open perspective---MyEclipse database explorer-- ......
功能说明:Java servlet 把XML数据压缩后发送到PB用户端,PB收到数据后解压出来.
传输要经过Base64编码.
问题是:能收到数据但是解压不出来.想请教大家或者有什么好的办法?
PB可以用"zlibwapi.DLL" 解压
......