views:

467

answers:

3

I want to translate xml documents with a certain schema into another schema. I know both the old and new schemas...

I am planning to use python's xml.dom library , and translate line by line.

Any ideas on how to go about it ? Any tools or libraries in other languages that might make this easier/more efficient.

Thanks!

+4  A: 

You could craft an XSLT to do this work for you. XSLT is specifically designed for the translation of XML data into some other text-based format, including XML. For more information on XSLT, I recommend W3 Schools.

Jeff Yates
thanks, this worked ..
sundeep
+1  A: 

This is what XSLT was designed for. Since you know both schemas then you write an XSLT sheet that takes the original document and transforms it into the new schema. Its especially easy if there is a one to one mapping from old schema to new.

Vincent Ramdhanie
thanks, this worked ..
sundeep
A: 

XSLT is the "recommended" way of doing it. However, you could probably do it faster with your python xml dom if you are familiar with python. Learning XSLT is a good idea though. I have to do this myself and I will be doing it with perl.

Mark Beckwith