Reputation: 69
I have a table thats
<Actor id="RobertDowneyJr">
<Name>Robert Downey Jr.</Name>
<BirthDay>1965-04-04</BirthDay>
<BirthPlace>Manhattan, New York City, New York, USA</BirthPlace>
</Actor>
<Actor id="TerrenceHoward">
<Name>Terrence Howard</Name>
<BirthDay>1969-03-11</BirthDay>
<BirthPlace>Chicago, Illinois, USA</BirthPlace>
</Actor>
And i want to use Xpath to only find actors who's born in chicago, but there's something i do wrong
//Disney/Actors/Actor[@BirthPlace = 'Chicago']/BirthPlace
//Disney/Actors/Actor[BirthPlace = 'Chicago']
I just want it to show every actor that is only born in chicago.
Upvotes: 0
Views: 20
Reputation: 24930
Try it this way:
//Disney/Actors/Actor[contains(./BirthPlace,'Chicago')]
The full <BirthPlace>
is Chicago, Illinois, USA
, not just Chicago
, so you have to switch from =
to contains()
.
Upvotes: 1