Recreating a binary stack from xml text

Mark Wieder mwieder at ahsoftware.net
Sat Feb 18 15:07:32 EST 2012


Pete-

Saturday, February 18, 2012, 11:33:51 AM, you wrote:

> I saw a post earlier in this thread that perhaps Mark Wieder might be
> working on something along these lines.  Mark, can you comment?

If revOnline ever comes back (hello rev team?) I'll post a stack that
does the translations.

Getting to an from xml format isn't that much of a problem technically
now that ids are no longer immutable. What's a bit more of a brain
teaser is preserving the object hierarchy at the same time. I opted
for individual xml files for each control, card, and stack, as well as
a project xml file that describes how the objects are organized. That
way you can create the entire stack from the xml descriptions or just
pick out individual controls and recreate them.

Creating an object from the xml description is a matter of looping
through the properties, as in

-- in a try construct to handle read-only properties
try
  set the <property> of <object> to <attribute>
catch e
end try

<stack>
 <card>
  <group>
   <control>
    <property>
    </property>
   </control>
  </group>
  <control>
  </control>
 </card>
 <substack>
 ... etc
 </substack>
</stack>

-- 
-Mark Wieder
 mwieder at ahsoftware.net





More information about the use-livecode mailing list