I am working in a project where we create XSD schemas, and would like to generate sample xml instances for testing purposes. In eclipse, there is an XSD editor that has the option Generate > XML which does it by a click of a button. But I would like to convert this mouse click to a Builder, Maven or Ant task. Any ideas of how to do it?
views:
26answers:
1
A:
You might have to write your own ant task and make use of a java library to convert a schema to xml. For example:
- Sun's XML Instance Generator (xmlgen.zip) which is part of Sun's Multi-Schema XML Validator(MSV)
- XML-XIG
By the way, I don't see why you want to generate test xml files as part of your build process. Shouldn't test resources be kept static instead of being regenerated every time?
dogbane
2010-09-20 11:55:23
Thanks - i am investigating the XML gen that you suggested - and can run it with an ant task. I was just wondering if it is possible to get a hook to the underlying generator in the Eclipse MDT XSD project.Why I want to regenerate the test ressources? Well the schemas keep changing - its a BIG project - and I want to have unit tests (based on xpath) that make sure they are still consistent, and live up to companys standards.Agata
Agata Przybyszewska
2010-09-21 12:07:18