newLISP Fan Club

Forum => newLISP in the real world => Topic started by: Jeremy Reimer on May 26, 2010, 10:34:34 AM

Title: Strange problem with contexts and xml-parse
Post by: Jeremy Reimer on May 26, 2010, 10:34:34 AM
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:



(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:



((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!
Title: Re: Strange problem with contexts and xml-parse
Post by: Lutz on May 27, 2010, 04:17:53 AM
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.
Title: Re: Strange problem with contexts and xml-parse
Post by: Jeremy Reimer on May 27, 2010, 10:18:56 AM
Thanks, I upgraded to 10.2.8 and the problem went away.  Sweet!