I have the following xml:
<Products>
<Product>
<name>Sample name</name>
<attribute id="sampleid" location="sampleLocation" type="sampleType"/>
<price>12345</price>
</product>
</Products>
How can I return the following data from this XML for a given name (always unique):
1. location (e.g. "sampleLocation")
2. type (e.g. "sampleType")
3. price (e.g. 12345
I currently am able to query each individually to return values, but im not sure of the syntax to return multiple values together.
Example of individual query for location:
ResourceSet resourceSet = service.query(
format("//Products/Product[name='%s']" +
"/attribute/@Location/string()"
, StringEscapeUtils.escapeXml(journey_Name)
));
The query above will return: "sampleLocation".