[REBOL] Re: object2XML
From: robert:muench:robertmuench at: 6-Mar-2004 14:02
On Fri, 05 Mar 2004 14:34:03 -0800, Terry Brownell <[tbrownell--veleng--com]>
wrote:
> Anyone have a simple example using Gavin's xml-object.r and xml-parse.r
> that shows...
>
> 1. Reading an XML document.
> 2. Converting to an object for manipulation within rebol.
> 3. Converting that object back into XML are re-writning it back to the
> file
>
> <person><name>Bob</name><email>[bob--spam--com]</email></person>
>
> How would one change the email and save it back?
Hi, what's the big problem about it? You parse the XML into a stream of
tags and content. Than build a block with tag-words used as set-words of
an object, and the content (plain append should do the job) and than use
this block as prototype for a new object.
But you should think about using an object at all. I would use a block of
name/value pairs. Much easier to handle. Converting such a block back to
XML is easy. Yes, I know I shouldn't talk only about how to do it but do
it... but other things on my todo-list. Robert