Parsing xml file using xpath and xquery

abroad

New Member
I have a xml file\[code\]<category> <type name="SWEATERS"> <product id =1> <itemNumber>1</itemNumber> <name>ProductA2</name> <price>345</price> </product> </type> <type name="PANTS"> <product id=2> <itemNumber>4</itemNumber> <name>Product Test </name> <price>456</price> </product> </type></category>\[/code\]I used the xquery\[code\]$xml->xpath('//category/type/product[@id=1]');\[/code\]The out put will give the itemNumber name and price.How i can get the type name i mean SWEATERS
 
Back
Top