Hi,

is it possible to select an element from an XML file with XPath, check its contents for certain criteria and then select one of its siblings?

Qt Code:
  1. <List>
  2. <Item>
  3. <Data>
  4. <Hierarchy>Item</Hierarchy>
  5. <ShortName>MyItem</ShortName>
  6. <Name>ReallyMyItem</Name>
  7. </Data>
  8. </Item>
  9. <Item>
  10. <Data>
  11. <Hierarchy>SubItem</Hierarchy>
  12. <ShortName>MySubItem</ShortName>
  13. <Name>ReallyMySubItem</Name>
  14. </Data>
  15. </Item>
  16. </List>
To copy to clipboard, switch view to plain text mode 
So I want to get the name of every item that is an "Item", but not of "SubItem"s.

I tried to fetch the whole "Data" and try to get out the info but failed to get the query for the sub part valid, so I abandoned that idea.
Now I am fetching the "Hierarchy" into a QXmlResultItems element. Then I run over it in a loop and find all "Item"s. But what then? Can I access its siblings from the resulting QXmlItem by any chance?

Or is my attempt wrong in the first place? All this XML stuff is kind of hard to grasp for me.

Regards