XML query assistance

(imported topic written by sinucus)

I’m having some problems with XML queries. I’ve been able to extract how the information that I’m looking for in 1 specific file, but I did it in a non standard way which I will be unable to support moving forward, so I’ll need a better, more flexible solution to this problem… Below is some sample XML data.

I have multiple “unnamed” nodes with multiple attributes, some with the same attribute name. Nothing is standard in the building of the XML, i.e. They may or may not have the same attribute name, they may nor may not be in the same attribute location (i.e. 0,1,2). So, I’m looking for a way to call specific lines. So in this case, I want to find the “value” whose “name” is “FormatName” under the component node “cid=1”, but I don’t know if cid=“1” will be node 1 or 2, etc… Thanks in advance

<?xml version="1.0" encoding="utf-8"?>

(imported comment written by SystemAdmin)

You should use Xpath for this: http://www.ibm.com/developerworks/forums/thread.jspa?threadID=415490