2

I have a frequent use case of handling collections of XML documents that have a common structure but almost always utilize just a small subset of the allowed elements. For testing purposes I would prefer an example XML that would contain all the allowed elements. I can of course use some tools to infer XSD from the XML documents, and use the XSD to generate an example XML, but the resulting document would just contain filler data, using any of the XSD-to-XML tools I know. Instead, I would like to generate a document with real data, i.e. an "address" element would contain the text from the "address" element of one of the original XML documents.

4
  • Something like XBEGene? link.springer.com/chapter/10.1007%2F978-3-642-28807-4_63#page-1 Usually just have to get a large set of the real data and use a sub set of that for testing. You generate the subset by searching the real data looking for the edge cases that populate structures that aren't usually populated. So far as I know there is no tool commercially available that does what you are asking. Also asking for tools is off topic for this site, unless you are asking how to program one. :-)
    – Dijkgraaf
    Nov 17, 2014 at 1:50
  • I am just looking for the simplest solution, whether that is an existing tool or a one-liner in any common programming language. I don't really need to generate a statistically representative example like XBEGene seems to do, but an example with values from a given data set. As I can already generate an example document with all allowed elements, an approach that just replaces the generated dummy values with values from a given set of documents would be fine. Nov 17, 2014 at 7:03
  • possible duplicate of Any tools to generate an XSD schema from an XML instance document?
    – Dijkgraaf
    Nov 18, 2014 at 22:00
  • No, this is not a duplicate. I have no problem generating an XSD with for example Trang. Nov 19, 2014 at 0:41

1 Answer 1

0

I have the same issue like you. I think this blog, describes in a nutshell your need: http://www.altova.com/newsletter/newsletter_2013_02.html but the solution they propose is unfortunately a commercial solution and you would have to pay for their tool in order to do that. I am sure if you research a bit more (and I am doing the same) there could be a free tool of this sort... Hope that helps...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.