I’ve got to build an XSD file for XML structure verifying purposes, as usual.
After generating the XSD (with XMLSpy), I’ve found one portion of the file that is giving me trouble. I’ve got an enumeration like this:
<xs:enumeration value="1"/>
<xs:enumeration value="1011"/>
<xs:enumeration value="1032"/>
and so on. The problem is, any given integer in this enum must be considered valid, and I cannot write enumeration tags from 1 to, let’s say, 65635.
And I also don’t know how much of this enum elements will be necessary, because the number of these enumeration tags on the XML file is not fixed!
How can I tell the XSD that any integer value is ok, and that there is no minimal or maximal matches on the XML file for this enumeration?
Thanks in advance (and sorry for my english!)
Your question doesn’t show enough information to tell a precisely correct answer, but this will probably solve your problem.
You probably have some code like this:
This piece of schema defines an element
<foobar>and a simple typeenumTypethat is the content type of the<foobar>element. So, you asked:You don’t need to enumerate separately all the valid values for
<foobar>like you have to do with DTD. Instead you can just use the predefined types of XML Schema in thetypeattribute.Here is an example code that defines an element
<foobar>and allows it to contain any integer.If I misinterpreted your question, please leave a comment and define your problem more closely. Also revealing more of your schema would be helpful.