Reputation: 11
I have a template XML file written using mako engine which is used to generate a config XML file. Below is a sample template.
<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank>${rank}</rank>
<year>2008</year>
% if gdppc:
<gdppc>${gdppc}</gdppc>
% endif
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/>
</country>
</data>
A config file is generated using the template, as shown below. Call it version 1.
<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank>1</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/>
</country>
</data>
New changes are made to the config file that might look like this. Call it version 2. Changes could be modification to nodes, tags, attributes, etc.
<data>
<country name="Liechtenstein">
<rank>1</rank>
<year>2009</year>
<gdppc>141100</gdppc>
<neighbour name="Austria" direction="E"/>
</country>
</data>
Now how do I identify the new changes and patch them into the template? Or what is the right approach to update template files given the changes?
I have tried using xmldiff to extract and patch the changes into the template, but there are two problems when using it.
Upvotes: 1
Views: 93