Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8367317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:07:36+00:00 2026-06-09T13:07:36+00:00

Here is the following code excerpted from the Spring-ws manual: public class HolidayEndpoint {

  • 0

Here is the following code excerpted from the Spring-ws manual:

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

My problem is that this appears to be using JDOM 1.0 and I’d like to use JDOM 2.0.

How do I convert this code from JDOM 1.0 to JDOM 2.0? Why hasn’t spring updated their sample code?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:07:37+00:00Added an answer on June 9, 2026 at 1:07 pm

    JDOM2 is still relatively new…. but, the XPath factory in JDOM 1.x is particularly broken… and JDOM 2.x has a new api for it. The old API exists for backward compatibility/migration. Have a look at this document here for some reasoning, and the new API in JDOM 2.x.

    In your case, you probably want to replace the code with something like:

    XPathExpression<Element> startDateExpression = 
        XPathFactory.instance().compile("//hr:StartDate", Filters.element(), null, namespace);
    
    List<Element> startdates = startDateExpression.evaluate(mydocument);
    

    Rolf

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following code: public class A { public A():this(null){} public A(string b){/*code here*/}
I have following code: public static void ProcessStep(Action action) { //do something here if
The following code is taken from here . I removed all Windows NT part
The following code, copied from the Facebook documentation here , is not working for
Here the following code i have, but there's error. Can someone help? public void
here the following code is used to view the present modal view controller. [[self
Here is the following code-snippet I'm using in my Google Spreadsheet onEdit() function: else
I have the following code here that won't run on ARC since it combines
Have a look here: In the following code, what would be the type of
The following code has concurrency issues. Here inDegVec is a global int * ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.