Jump to content

XML/XPath: Difference between revisions

Line 608:
}
alert( names );</lang>
 
=={{header|Mathematica}}==
<lang Mathematica>example = Import["test.txt", "XML"];
Cases[example, XMLElement["item", _ , _] , Infinity] // First
Cases[example, XMLElement["price", _, List[n_]] -> n, Infinity] // Column
Cases[example, XMLElement["name", _, List[n_]] -> n, Infinity] // Column</lang>
Output:<pre>
XMLElement[item,{upc->123456789,stock->12},
{XMLElement[name,{},{Invisibility Cream}],XMLElement[price,{},{14.50}],XMLElement[description,{},{Makes you invisible}]}]
 
14.50
23.99
4.95
3.56
 
Invisibility Cream
Levitation Salve
Blork and Freen Instameal
Grob winglets
</pre>
 
=={{header|Objeck}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.