使用Dom4j和XPath解析spring 的配置文件

 Map m = new HashMap<String, String>();
 m.put("s", "http://www.springframework.org/schema/beans");
 XPath xpathSelector = DocumentHelper.createXPath("//s:ref");
 xpathSelector.setNamespaceURIs(m);
List<Node> list = xpathSelector.selectNodes(document);


注意对于使用schema进行验证的spring configuration

要在XPath上加入域名空间。 xpathSelector.setNamespaceURIs(m);

posted on 2008-12-16 16:27 刘铮 阅读(660) 评论(0)  编辑  收藏 所属分类: Dom4j


只有注册用户登录后才能发表评论。


网站导航:
 
<2024年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

导航

统计

留言簿(1)

文章分类(141)

文章档案(147)

搜索

最新评论