where Anweisung mit XPath ?!

NetPerformance

Erfahrenes Mitglied
Hallo Zusammen,

ich möchte aus der XML Struktur all cities von country_1 abfragen.

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<elements>
            <element>
                        <city>city_1</city>
                        <country>country_1</country>
            </element>       
            <element>
                        <city>city_2</city>
                        <country>country_1</country>
            </element>       
            <element>
                        <city>city_1</city>
                        <country>country_2</country>
            </element>
</elements>


So kann ich alle cities abfragen:
Code:
//elements/city/text()

So kann ich nur nach country_1 suchen
Code:
//elements[country='USA']

Ich benötige eine vergleichbare Anweisung in XPath:

Select all cities where country = 'country_1'

Ist eine solche Anweisung in XPath möglich ?

Beste Grüße
Aaron
 
Zurück