File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Problem in XPath while using index such as //day[7] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Problem in XPath while using index such as //day[7]" Watch "Problem in XPath while using index such as //day[7]" New topic

Problem in XPath while using index such as //day[7]

Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Hi guys,

First I will present the XML file.

The week is going to repeat another 4 times.

I need to find all the day as well as using index.

The problem for me is it is working for one week, that means the currentDay value is working from 1 to 7.

For the next week the currentDay will be greater than 7 it is not able find the element(day).

Can anybody give me any alternative XPath expression for this situation.

Thanks for your comments.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19351

Okay... does that mean that the actual XML document has 35 <day> elements, and you want to select the ones with number="7"? Or does it mean that you need to convert the day of the month to the day of the week? Or does it mean something else? I think you should clarify your requirements before you start implementing them.
I agree. Here's the link:
subject: Problem in XPath while using index such as //day[7]