Thanks for the advice - the good news is that each child tree will have a 
unique id. So finding new or mssing child trees will be the easy part - since I 
wrote that original email I've been playing with how to do a diff between two 
arrays which is working well - it tells me which elements are new and which are 
gone. So the hope there is that I can filter out child trees that are identical 
and only do the diff on those that have changed. Can you think of anything else 
which would speed up the process?

oh - also - each option will have a unique id and a set list of attributes 
which is good news. The values may change but that can all be part of the 
comparison.




-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Ron Wheeler
Sent: Sat 6/10/2006 5:07 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] XML diff
 
Just hang onto the xml tress and walk them in parallel. Depending on the 
types of changes that might happen, you will have varying degrees of 
difficulty in matching the trees. Probably easier than a diff on a text 
file.

Possible tests:
For each node,
    check attributes for changes - easy if you have a list of possible 
attributes - missing or new attributes
    If you have node values - did they change
    check number of children - more  or less?? What to do if a child 
tree is missing? What to do if you have a whole new child tree.
    How do you match the children between the old and new trees? - do 
they have unique ids or attributes that never change so you can find the 
same subtrees to compare.
<options id="file handling">

  <group id="text files">
    <option id="open"... />
    <option id="not open"... />
  </group>

  <group id="image files">
    <option id="open"... />
    <option id="not open"... />
    <option id="pretty"... />
    <option id="not pretty"... />
  </group>
</options>...

    recurse through children.
You


Not terribly difficult once you think of the tree structure and once you 
think about what kind of changes you are prepared to handle.

Ron

Howard Nager wrote:
> I have an upcoming project and am trying to figure out how to do what would 
> best be described as a diff on a xml file. 
>
> For example, here would be the initital xml:
>
> <root>
> <optionsA>
>   <group>
>     <option ... />
>     <option ... />
>   </group>
>
>   <groupB>
>     <option ... />
>     <option ... />
>     <option ... />
>     <option ... />
>   </group>
> ...
> </root>
>
> The way the system works is that all of the logic is handled server side. So 
> when the user selects an option it hits the server and gets back another xml 
> file with an updated price and more or less options depending on whatever 
> rules came in to play. 
>
> The front end was originally an html page which would redraw itself with 
> every interaction. If I were to just emulate that model I would grab the new 
> xml and redraw the menu within my flash movie with every selection. The issue 
> with that is that each option has an associated thumbnail image loaded 
> externally and redrawing hte menu would mean reloading all of those.
>
> I would rather look at the new and old xml files side by side and see what 
> changed so that I could leave anything that didnt change alone.
>
> Any ideas on this?
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to