Page 1 of 1

Strange problem with contexts and xml-parse

Posted: Wed May 26, 2010 5:34 pm
by Jeremy Reimer
Hi all! Thanks for your incredible help so far.

I've come across a puzzler: I am using xml-parse to extract data from an XML feed and into a newLISP list. This is the function I'm using:

Code: Select all

(define (parse-xml-data str)
   (xml-type-tags nil nil nil nil)
      (let ((xml (xml-parse str 15 'Yamato)))
        (or xml (throw-error (xml-error)))))
I'm using "'Yamato" to try and save the resulting list in a different context, so that any symbols that are created don't conflict with existing symbols in newLISP's MAIN context, or in the Dragonfly context. However, this doesn't seem to work, as I get the resulting SXML list back:

Code: Select all

((Yamato:document (Yamato:element ((Yamato:name "First") (date "4/23/2010")) (Yamato:data "This is the first element")) (Yamato:element ((Yamato:name "Second") (date "4/23/2010")) (Yamato:data "This is the second element")))) 
Every symbol is now in the "Yamato" context, except for "date". "date" is a symbol in the Dragonfly context. I want it also to be in the Yamato context, but it seems like the Dragonfly context is overriding this when xml-parse converts the XML element names into symbols. How can I stop this and force every element into the Yamato context?

Thanks for your help!

Re: Strange problem with contexts and xml-parse

Posted: Thu May 27, 2010 11:17 am
by Lutz
Make sure you are using the latest newLISP 10.2.8 release. There was a bug in 10.2.1, where names of newLISP built-in functions (like 'date') would not receive the context prefix.

Re: Strange problem with contexts and xml-parse

Posted: Thu May 27, 2010 5:18 pm
by Jeremy Reimer
Thanks, I upgraded to 10.2.8 and the problem went away. Sweet!