XML to XML: XSLT or XSD?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have a general design question on how best to solve a requirement.
My task is to convert an xml document (A) into an xml document (B) that conforms to an xsd (google product feed format). XML A is already in place; I cannot modify the outputting or formatting of it. XML B must be well formed and valid per the
xsd which is a google product feed xml.
Option 1: do i use XSLT to transform A to B?
Option 2: do i use xsd.exe to create a class that represents B and load A into B (ie no need for XSLT).
I personally like option 2 because I can easily validate the xml against the xsd when the load is done. If the xml text is too long, wrong type, etc the validation will fail.
Option 1 may put the xml in a format close to B, but how do I make sure the text is the right type, length, etc...For option 1 Ill still need to attach it to the xsd and verify its well formed and valid before I send it to google. I see the XSLT
as just an extra step that doesnt directly produce the desired output as quickly/accurately...
Any thoughts or other options? Thanks for your help,


View the full article
 
Back
Top