previous
|
start
|
next
Parsing XML Documents
To get the number of items (2), use the XPath expression:
count(/items/item)
The total number of children (2) can be obtained as:
count(/items/*)
To select attributes, use an @ followed by the name of the attribute:
/items/item[2]/product/price/@currency
To find out the name of a child in a document with variable/unknown structure:
name(/items/item[1]/*[1])
The result is the name of the first child of the first item, or
product
previous
|
start
|
next