Map m = new HashMap<String, String>();
m.put("s", "http://www.springframework.org/schema/beans");
XPath xpathSelector = DocumentHelper.createXPath("http://s:ref");
xpathSelector.setNamespaceURIs(m);
List<Node> list = xpathSelector.selectNodes(document);
注意對于使用schema進行驗證的spring configuration
要在XPath上加入域名空間。 xpathSelector.setNamespaceURIs(m);