【发布时间】:2012-08-10 01:26:59
【问题描述】:
以下代码摘自 Spring-ws 手册:
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?为什么spring没有更新他们的示例代码?
谢谢!
【问题讨论】:
-
您是否更新了导入以使用 jDom2?例如,Element 的导入是
import org.jdom2.Element;。
标签: java spring-ws jdom jdom-2