XML : Defining comma-separated values in XSD

I am trying to make a restriction that requires a value of two positive integers separated by a comma. I looked through other posts but it seemed like what I'm trying to do is simpler than in other problems. This is what I have so far:

  <xs:element name="cell" maxOccurs="unbounded">         <xs:simpleType>                 <xs:restriction base="xs:positiveInteger">                        <xs:pattern value="[1-1000],[1-1000]"/>                 </xs:restriction>         </xs:simpleType>  </xs:element>    

I want the resulting value to look like this (example): <cell>4,15</cell>.

I have a second element <dimensions> that is similar, but instead of a comma, I want the integers separated by the letter 'x.' So an example of a value for this element would be <dimensions>20x20</dimensions>.

First, am I even using the right base data type? I also tried a whole bunch of combinations using xs:string with no luck. Second, how do I express the patterns?

No comments:

Post a Comment