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?
------------------------------------------------------------------------

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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