Monday, November 19, 2018

#1 2018-09-12 04:09:05 pm

Cal1618
Member
Registered: 2018-09-08
Posts: 1

Parsing XPATH Applescript

I'm looking for some help parsing an XPATH that would then paste into Numbers. I have a script that worked with XML. 
http://www.sportsline.com/nfl/odds/", "//div[@class='row-group']

This is a portion of the script for the XML, and I'm not really sure where to start to parse XPath.  I was hoping for some guidance and help.

Applescript:

set txt to do shell script "curl -s " & "http://www.nfl.com/liveupdate/scorestrip/ss.xml"

set pasteStr to ""
repeat with p in txt's paragraphs
   set lineTxt to p's text
   if lineTxt starts with " <g " then ¬
       set pasteStr to pasteStr & ¬
           getVal(lineTxt, "t=\"") & tab ¬
           & getVal(lineTxt, "h=\"") & tab ¬
           & getVal(lineTxt, "hs=\"") & tab ¬
           & getVal(lineTxt, "v=\"") & tab ¬
           & getVal(lineTxt, "vs=\"") & tab ¬
           & getVal(lineTxt, "Q=\"") & return
   
end repeat
set the clipboard to pasteStr

Offline

 

#2 2018-09-14 06:39:54 pm

technomorph
Member
Registered: 2017-12-14
Posts: 74

Re: Parsing XPATH Applescript

Do a search for xml and a few will show up.
Infound the one xml running slowly was most helpful to me

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)