Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: disappearing data?

From: joel:neely:fedex at: 13-Nov-2000 4:39

Hi, Ryan, [rebol-bounce--rebol--com] wrote:
> I've created an object with a function which converts data in another > object into XML. But the function will only work ONCE. Why?
Because your Markup-Data function steps Xml-Tags through its series value (initialized to a 5-element block) and then leaves it positioned at the end. Therefore, on the next call, the Length? is zero. Either use a local (to the function) variable, initialized as in working-xml-tags: copy xml-tags and iterate over the copy, or add xml-tags: head xml-tags at the end of Markup-Data. -jn-
> Here is > the console session... > > >> translate-message: make object! [ > [ > [ xml-tags: [ > [ ["author" "/author"] > [ ["subject" "/subject"] > [ ["date" "/date"] > [ ["content" "/content"] > [ ["messageID" "/messageID"] > [ ] > [ > [ markup-data: func [ > [ data [object!] > [ ][
...
> [ for x 1 (length? xml-tags) 1 [
...
> [ xml-tags: next xml-tags > [ object-data: next object-data > [ append output made-tag > [ output > [ ] > [ ] > [ ] > >>
Your function Markup-Data essentially steps Xml-Tags through its series value, leaving it positioned at the end of the series. Since you never reset