Strange problem with contexts and xml-parse

Q&A's, tips, howto's
Locked
Jeremy Reimer
Posts: 19
Joined: Thu May 13, 2010 5:36 pm

Strange problem with contexts and xml-parse

Post 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!

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Strange problem with contexts and xml-parse

Post 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.

Jeremy Reimer
Posts: 19
Joined: Thu May 13, 2010 5:36 pm

Re: Strange problem with contexts and xml-parse

Post by Jeremy Reimer »

Thanks, I upgraded to 10.2.8 and the problem went away. Sweet!

Locked