java - Search child node in XML by sub-node content -
i'm noob whith xpath , have question: how can search child in branches particular name , display information in xml file?
<?xml version="1.0" encoding="utf-8"?> <movie><?xml version="1.0" encoding="utf-8"?> <movie> <film> <name>peaceful warrior</name> <actor>scott mechlowicz</actor> </film> <film> <name>gone</name> <actor>scott mechlowicz</actor> </film> <film> <name>gladiator</name> <actor>russel crowe</actor> </film> </movie> i tried:
//*[ancestor::movie/film[name = "scott mechlowicz"]] but shows information, when intention show movies in actor participates.
is possible xpath or must use getnamebytagname nodelist?
you can use xpath. if trying list of names of movies, try xpath (get name of film actor = "scott mechlowicz")
//film[actor = "scott mechlowicz"]/name or
/movie/film[actor = "scott mechlowicz"]/name
Comments
Post a Comment