I want to form an xsd schema for an XMl whose elements will range from z1-zx. Is it possible to define this in the xml schema without having to write out declare each of the elements.
Please see below:
<?xml version="1.0"?>
<Zones>
<Z1>Asset00</Z1>
<Z2>Asset00</Z2>
</Zones>
I want the zones to be able to go upto Zxxx without having to declare each and every one in the XSD, is it possible to do this?
Please note that I wouldn't be able to change the structure of the xml, as I am using this for another software which can only take this format.
XSD 1.0
The best you can do in XSD 1.0 is allow any elements under
Zones
:XSD 1.1
In XSD 1.1 you can go further and constrain the names of the children of
Zones
to start withZ
:You could go even further and require that the string after the
Z
prefix be a number and probably even impose a sorted constraint as well, but this should get you pointed in the right direction.