XML/XPath: Difference between revisions

Added Bracmat example
m (→‎{{header|Sidef}}: changed the keyword "require" to function call)
(Added Bracmat example)
Line 139:
 
{"14.50", "23.99", "4.95", "3.56"}</lang>
 
=={{header|Bracmat}}==
<lang bracmat>{Retrieve the first "item" element}
( nestML$(get$("doc.xml",X,ML))
: ?
( inventory
. ?,? (section.?,? ((item.?):?item) ?) ?
)
?
& out$(toML$!item)
)
 
{Perform an action on each "price" element (print it out)}
( nestML$(get$("doc.xml",X,ML))
: ?
( inventory
. ?
, ?
( section
. ?
, ?
( item
. ?
, ?
( price
. ?
, ?price
& out$!price
& ~
)
?
)
?
)
?
)
?
|
)
 
{Get an array of all the "name" elements}
( :?anArray
& nestML$(get$("doc.xml",X,ML))
: ?
( inventory
. ?
, ?
( section
. ?
, ?
( item
. ?
, ?
( name
. ?
, ?name
& !anArray !name:?anArray
& ~
)
?
)
?
)
?
)
?
| out$!anArray {Not truly an array, but a list.}
);</lang>
 
=={{header|C sharp}}==
483

edits