parsing an xml to separate local files
Posted: Tue Sep 15, 2009 11:41 pm
Hi - I am trying to put together a few bits of code from cormullion's superb introduction here:
http://www.newlisp.org/dokuwiki/doku.ph ... g_with_xml
but am ending up with:
ERR: value expected : (0 2 9 0)
The two bits Im trying to merge are commented in the code below, along with my attempt to take the titles from the xml file and make them into local file names. From there I want to put the links and description into each respective file.
Would anyone be able to say which part of the manual I need to go back and study? I cant seem to get inside of the dolist to insert a save command for each title as it is recursed through. Thanks for any sort of tip.
http://www.newlisp.org/dokuwiki/doku.ph ... g_with_xml
but am ending up with:
ERR: value expected : (0 2 9 0)
The two bits Im trying to merge are commented in the code below, along with my attempt to take the titles from the xml file and make them into local file names. From there I want to put the links and description into each respective file.
Would anyone be able to say which part of the manual I need to go back and study? I cant seem to get inside of the dolist to insert a save command for each title as it is recursed through. Thanks for any sort of tip.
Code: Select all
#!/usr/bin/newlisp
(set 'xml (get-url "http://shop.ebay.com/i.html?_nkw=lisp&_rss=1"))
(xml-type-tags nil nil nil nil)
(set 'sxml (xml-parse xml 15))
;(println (lookup 'title (sxml (chop (ref 'item sxml)))))
;(save (lookup 'title (sxml (chop (ref 'item sxml)))))
;(dolist (el (ref-all 'title sxml))
; (println (rest (sxml (chop el)))))
(dolist (el (println (lookup 'title (sxml (chop (ref-all 'item sxml))))))
(save (lookup 'title (sxml (chop (ref-all 'item sxml))))))
(exit)