<p>I'm considering Altova MapForce (or something similar) to produce either XSLT and/or a Java or C# class to do the translation. Today, we pull data right out of the database and manually build an XML string that we post to a webservice. </p>

<p>Should it be db -> (internal)XML -> XSLT -> (External)XML? What do you folks do out there in the wide world?</p>

[{'answer_id': 79614, 'author': 'Jason Jackson', 'author_id': 13103, 'author_profile': 'https://Stackoverflow.com/users/13103', 'pm_score': 3, 'selected': True, 'text': '<p>I would use one of the out-of-the-box XML serialization classes to do your internal XML generation, and then use XSLT to transform to the external XML.  You might generate a schema as well to enforce that the translation code (whatever will drive your XSLT translation) continues to get the XML it is expecting for translation in case of changes to the object breaks things.</p>\n\n<p>There are a number of XSLT editors on the market that will help you do the mappings, but I prefer to just use a regular XML editor.</p>\n'}, {'answer_id': 79621, 'author': 'Don', 'author_id': 6845, 'author_profile': 'https://Stackoverflow.com/users/6845', 'pm_score': 1, 'selected': False, 'text': "<p>ya, I think you're heading down the right path with MapForce.  If you don't want to write code to preform the actual transformation, MapForce can do that for you also. THis may be better long term b/c it's less code to maintain.</p>\n\n<p>Steer clear of more expensive options (e.g. BizTalk) unless you really need to B2B integration and orchestration.</p>\n"}, {'answer_id': 79626, 'author': 'David Medinets', 'author_id': 219658, 'author_profile': 'https://Stackoverflow.com/users/219658', 'pm_score': 0, 'selected': False, 'text': '<p>What database are you using? Oracle has some nice XML mapping tools. There are some Java binding tools (one is <a href="http://java.sun.com/developer/technicalArticles/WebServices/jaxb" rel="nofollow noreferrer">http://java.sun.com/developer/technicalArticles/WebServices/jaxb</a>). However, if you have the luxory consider using Ruby which has nice built-in "to_xml" methods.</p>\n'}, {'answer_id': 79752, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p><strong>Tip #1: Avoid all use of XSLT.</strong> </p>\n\n<p>The tool support sucks. The resulting solution will be unmaintainable.</p>\n\n<p><strong>Tip #2: Eliminate all unnecessary steps.</strong> </p>\n\n<p>Just translate your resultset (assuming you\'re using JDBC or equiv) to the outbound XML.</p>\n\n<p><strong>Tip #3: Assume all use of a schema-based tool to be incorrect and plan accordingly.</strong> </p>\n\n<p>In other words, just fake it. If you have to squirt out some mutant SOAP (redundant, I know) payload just mock up a working SOAP message and then turn it into a template. Velocity doesn\'t suck. </p>\n\n<p>That said, the best/correct answer, is to use an "XML Writer" style solution. There\'s a few. </p>\n\n<p>The best is the one I wrote, <a href="https://lox.dev.java.net/" rel="nofollow noreferrer">LOX (Lightweight Objects for XML)</a>.</p>\n\n<p>The public API uses a Builder design pattern. Due to some magic under the hood, it\'s impossible to create malformed XML.</p>\n\n<p><strong>Please note:</strong> If XML is the answer, you\'ve asked the wrong question. Sometimes, we\'re forced against our will to use it in some way. When that happens, it\'s crucial to use tools which minimize developer effort and improve code maintainability.</p>\n'}]
['https://Stackoverflow.com/questions/79594', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14836/']