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);