I am using Visual Studio's "Generate Sample XML" to achieve this transformation:
XSD -> (Sample) XML
I know it is called "sample". I appreciate "samples" won't have meaningful values; just a value that satisfies the XSD constraints
- i.e. 0 satisfies
xsd:integer
datatype constraint, - i.e. 3 tags are used to satisfy both
1..*
and0..*
sequence/minOccurs/maxoccurs constraints - and other conventions
However, when I click "Generate Sample XML", the resulting XML doesn't contain (at least one) tag for all the elements defined in XSD.
- I want an "exhaustive" XML; that is, resulting XML contains a tag for all elements defined in the XSD.
Specifically here are my circumstances:
- My XSD has an
<xsd:sequence>
which allows for a series of0..*
and1..*
elements. - Each of these elements is quite complex; each of these elements produces sample XML that is on average ~ 270 lines long.
- This
<xsd: sequence>
allows for 120 of these elements; each of which is unique. - That means, the sample XML for this
<xsd: sequence>
element could be 270 * 120 = 32,400 lines of resulting XML.
What I'm finding is that Generate Sample XML will not produce a document longer than 6,000 lines of XML.
This means it does not produce an "exhaustive" XML; it limits the output sample XML to only the first 30 tags (in the order they were listed as children of the <xsd: sequence>
in the XSD ** (see below) -- even if this means the resulting XML is invalid [since it could omit required elements]);
the remaining 120-30 = 90 elements defined in the XSD are excluded from the output sample XML.
Can anyone explain why? Is it user-error? Is there a workaround? No need to recommend other tools if they are already described here.
I can move this question to superuser if that's more appropriate.
** I believe the order in which the elements are referenced as children of <xsd:sequence>
is important; when I rearranged this order (for instance, moving children 51-53 to become first children; 1-3; then these elements included in the ~6,000 line output, but the other elements they displaced were excluded)