Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/XML-XPath/AutoHotkey/xml-xpath-1.ahk
Normal file
12
Task/XML-XPath/AutoHotkey/xml-xpath-1.ahk
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
FileRead, inventory, xmlfile.xml
|
||||
|
||||
RegExMatch(inventory, "<item.*?</item>", item1)
|
||||
MsgBox % item1
|
||||
|
||||
pos = 1
|
||||
While, pos := RegExMatch(inventory, "<price>(.*?)</price>", price, pos + 1)
|
||||
MsgBox % price1
|
||||
|
||||
While, pos := RegExMatch(inventory, "<name>.*?</name>", name, pos + 1)
|
||||
names .= name . "`n"
|
||||
MsgBox % names
|
||||
15
Task/XML-XPath/AutoHotkey/xml-xpath-2.ahk
Normal file
15
Task/XML-XPath/AutoHotkey/xml-xpath-2.ahk
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#Include xpath.ahk
|
||||
|
||||
xpath_load(doc, "xmlfile.xml")
|
||||
|
||||
; Retrieve the first "item" element
|
||||
MsgBox % xpath(doc, "/inventory/section[1]/item[1]/text()")
|
||||
|
||||
; Perform an action on each "price" element (print it out)
|
||||
prices := xpath(doc, "/inventory/section/item/price/text()")
|
||||
Loop, Parse, prices,`,
|
||||
reordered .= A_LoopField "`n"
|
||||
MsgBox % reordered
|
||||
|
||||
; Get an array of all the "name" elements
|
||||
MsgBox % xpath(doc, "/inventory/section/item/name")
|
||||
Loading…
Add table
Add a link
Reference in a new issue