操作带 命名空间的xml
来源:互联网 发布:塞班贝拉 淘宝 编辑:程序博客网 时间:2024/04/29 15:54
<ah:as>
<ah:bb>
<ah:MmbId>ICL</ah:MmbId>
</ah:bb>
</ah:as>
</ah:AppHdr>
如上报文,ah为命名空间,这种形式的报文用 dom4j 解析需要指定命名空间,不然会解析报错
map存在命名空间定义
Map<String, String>map=new HashMap<String, String>();
map.put("ah","urn:iso:std:iso:20022:tech:xsd:head.001.001.01");
map.put("doc","urn:iso:std:iso:20022:tech:xsd:pacs.008.001.06");
map.put("fps","urn:hkicl:fps:xsd:fps.envelope.01");
读取xml
SAXReader saxReader = new SAXReader();
File file = new File("F:\\S001.xml");
saxReader.getDocumentFactory().setXPathNamespaceURIs(map);
Document doc = saxReader.read(file); //这时生成的document就包含命名空间定义了
用xpath解析xml
List<Element> frEle = doc.selectNodes("//ah:Fr/ah:FIId/ah:FinInstnId/ah:ClrSysMmbId/ah:MmbId");
List<Element> toEle = doc.selectNodes("//ah:To/ah:FIId/ah:FinInstnId/ah:ClrSysMmbId/ah:MmbId");
得到元素再继续操作元素的值或者属性
- 操作带 命名空间的xml
- C#处理带命名空间的XML
- dom4j 解析带命名空间的XML
- 带有命名空间的xml 操作
- 带有命名空间的xml 操作
- XML——c#读取带命名空间的xml
- 对于带命名空间定义的XML目标的处理
- xml不带命名空间的序列化
- 用dom4j解析带命名空间的xml文件
- C# 读取带xmlns 命名空间的XML
- Flex中处理带命名空间的XML
- 用Dom4J解析带命名空间的XML文件
- Flex中处理带命名空间的XML
- 向带命名空间的XML中插子多个子结点
- c#代码查询带命名空间的xml文件
- Flex中处理带命名空间的XML
- .net解析带命名空间的xml写法
- jquery 解析带命名空间的xml文件
- Struts2中使用框架完成自动验证
- VS2008 STLport5.2.1爬虫使用实例
- Codeforces Round #424 C. Jury Marks (思维?)
- Session介绍、API、生命周期、应用
- 内存对齐的思考
- 操作带 命名空间的xml
- ElasticSearch中Java Search API
- 虚拟内存,虚拟内存地址,物理内存,物理内存地址
- idea工具的使用+【破解】()支持正版购买)。
- UItableViewCell 重用导致控件多次加载 去除cell重用导致 视图控件多次加载问题(转)
- 测试之计算机基础回顾 一
- C# System.Environment.GetFolderPath的使用
- Spring-data-JPA查询方法的总结
- 八大排序算法