How to generate a collection of testing XML datafi

2020-06-23 06:00发布

问题:

This question already has answers here:
Closed 7 years ago.

Possible Duplicate:
How to generate sample XML documents from their DTD or XSD?

Given an XSD schema, is there a means to generate a collection of XML files from this XSD schema (all of which successfully validate against that XSD schema) to be used for testing purposes?

We are creating a series of Java 6 applications which pass inputs/output using XML files. All XML files should successfully validate against one of our XSD schemas. The XSD schemas are quite complex, so creating XML files by hand for testing is prohibitive. We want a collection of testing XML files that will exercise the limits of the input data (so having a single XML data file will not be sufficient). Ideally, it would be nice to have a tool which allows a tester to pick a few values for each XML tag (the max value, the min value, a zero value, a negative value, etc) and then the tool will generate collections of XML files using combinations of those tester-chosen values.

The system is being tested upon a Microsoft Windows XP environment, but we could certainly generate the XML testing files upon a different environment (if a particular tool could help automate this). We would like this XML-generation-from-XSD capability for testing purposes and we do not need it within the application itself, so a stand-alone XML-generation tool could be used (if one exists).

related question: It seems that the only existing tool I found that even attempts this task is jCAM (main project site is at http://sourceforge.net/projects/camprocessor/; list of jCAM capabilities and tutorial available at https://www.oasis-open.org/committees/download.php/29661/XSD%20and%20jCAM%20tutorial.pdf). Other than the tutorial, I have not investigated this tool yet. Does anyone have experience with this tool?

回答1:

I have not used it in a while, but I know that Altova XmlSpy used to do this. You can get a free download or trial version of it (with 30 days of trial period) and give it a shot.

http://www.altova.com/xml-editor/