这里是从Spring-WS手册摘录如下代码:JDOM 2和XPath
public class HolidayEndpoint {
private static final String NAMESPACE_URI = "http://mycompany.com/hr/schemas";
private XPath startDateExpression;
private XPath endDateExpression;
private XPath nameExpression;
private HumanResourceService humanResourceService;
@Autowired
public HolidayEndpoint(HumanResourceService humanResourceService) (2)
throws JDOMException {
this.humanResourceService = humanResourceService;
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
startDateExpression = XPath.newInstance("//hr:StartDate");
startDateExpression.addNamespace(namespace);
endDateExpression = XPath.newInstance("//hr:EndDate");
endDateExpression.addNamespace(namespace);
nameExpression = XPath.newInstance("concat(//hr:FirstName,' ',//hr:LastName)");
nameExpression.addNamespace(namespace);
}
我的问题是,这似乎使用JDOM 1.0和我想使用JDOM 2.0。
如何将此代码从JDOM 1.0转换为JDOM 2.0?为什么不更新他们的示例代码?
谢谢!
你更新你的进口使用jDom2?例如,元素的导入是'import org.jdom2.Element;'。 – 2013-10-08 15:05:43