Hi, Ryan,

[EMAIL PROTECTED] 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
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to