Given the following: <?xml version="1.0" encoding="utf-8"?> <Project> <Network> <Unit> <UnitType>Type1</UnitType> <SerialNumber>123456</SerialNumber> </Unit> <Unit> <UnitType>Type2</UnitType> <SerialNumber>abcdef</SerialNumber> </Unit> [... snip...] </Network> </Project>
.. I need to extract all the serial numbers where UnitType is "Type2".
I have never managed to get my head around XPath etc, and all the examples I find seem either too general or too complex for me to make much progress. I always end up writing some code that parses it as text which is a massive cop out.
How best can I do this correctly using XML tools, and which tools should I use?
Mark