Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
12
Task/XML-XPath/CoffeeScript/xml-xpath-2.coffee
Normal file
12
Task/XML-XPath/CoffeeScript/xml-xpath-2.coffee
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Retrieve the first "item" element
|
||||
doc.evaluate('//item', doc, {}, 7, {}).snapshotItem 0
|
||||
|
||||
# Perform an action on each "price" element (print it out)
|
||||
prices = doc.evaluate "//price", doc, {}, 7, {}
|
||||
for i in [0...prices.snapshotLength] by 1
|
||||
console.log prices.snapshotItem(i).textContent
|
||||
|
||||
# Get an array of all the "name" elements
|
||||
names = doc.evaluate "//name", doc, {}, 7, {}
|
||||
names = for i in [0...names.snapshotLength] by 1
|
||||
names.snapshotItem i
|
||||
Loading…
Add table
Add a link
Reference in a new issue