aspose file tools
The moose likes XML and Related Technologies and the fly likes XPath Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "XPath" Watch "XPath" New topic
Author

XPath

Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 201
Hi,


i have the following XML and trying to run an xPath query to get the xml 'entry' fields that have a 'name' field that contains text "liz" AND 'entry' fields that contain a 'link' field that have an attribute 'rel' with "linkrel"

<xml>
<feed>
<entry>
<name>
liz
</name>
<link rel="linkrel"/>
<entry>
<name>
barry
</name>
<link rel="linkrel"/>
</entry>
<entry>
<name>
gobbly
</name>
</entry>
</feed>

any ideas?

Cheers,

Niall
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

I don't see anything about testing in the question. So let's move it to the XML forum.

In general when your specs for the XPath include "which" or "such that" then you need a predicate in your XPath expression.
Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 201
sound, just thought that it was a testing question, since its testing the XML schema,

like i know that there can be 2 XPath queries:

/feed/entry/link[@rel='linkrel']

and

/feed/entry[name = 'liz']

but how to combine them?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: XPath
 
Similar Threads
JMeter testing
How to preserve HTML tag during XSL transformation
atom and xml
RequiresNew timeout CMP Sequence Pattern
JMeter testing