Reputation: 1981
Ciao,
I'm working with XPath and I need to retrieve all elements by specific conditions.
Below one example of my XML document:
<?xml version="1.0" encoding="UTF-8"?>
<persone>
<persona>
<nome>Mario</nome>
<cognome>Rossi</cognome>
</persona>
<persona>
<nome>Mario</nome>
<cognome>Bianchi</cognome>
</persona>
<persona>
<nome>Marco</nome>
<cognome>Verdi</cognome>
</persona>
</persone>
I need to create an XPath query that return all elements with these two conditions true:
How can I achieve this goal?
Upvotes: 2
Views: 935
Reputation: 1981
I've resolved my problem using a query like this:
//persona[nome[text()='Mario'] and cognome[text()='Bianchi']]
Upvotes: 1