samedi 7 mars 2015

How do I synchronize 2 xml files?


I have 2 xml files named 1k.xml and 1n.xml. The contents are similar except for the text in one element.


The file 1k.xml contains some additional elements and data which are not there in 1n.xml. I want to copy whatever is absent in 1n.xml to it, so that both the files are identical except for the text in one element.



1k.xml
<verse>
<verse-no>...</verse-no>
<section>...</section>
<verse-content>...
</verse-content>
</verse>


1n.xml does not have the section element and the verse-content of 1n.xml is different from 1k.xml.



  1. All verses do not have section. The section must be inserted in the correct place - just above the verse-content of the correct verse-number.

  2. There is one more element called quote which is absent in 1n.xml which also need to be copied to it.


Is there a software to do this? Can I do it using perl or java (as I have experience only in these two)? Please point me to some tutorial or way through which I can synchronize these two files in every aspect except for the verse-content data.



Aucun commentaire:

Enregistrer un commentaire