Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
13
Task/XML-XPath/Nim/xml-xpath.nim
Normal file
13
Task/XML-XPath/Nim/xml-xpath.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import xmldom, xmldomparser
|
||||
|
||||
let doc = "test3.xml".loadXMLFile.documentElement
|
||||
|
||||
# 1st task: retrieve the first "item" element
|
||||
let i = doc.getElementsByTagName("item")[0]
|
||||
|
||||
# 2nd task: perform an action on each "price" element (print it out)
|
||||
for j in doc.getElementsByTagName "price":
|
||||
echo j.firstChild.PText.data
|
||||
|
||||
# 3rd task: get an array of all the "name" elements
|
||||
let namesArray = doc.getElementsByTagName "name"
|
||||
Loading…
Add table
Add a link
Reference in a new issue