ay.a1234 Posted May 8, 2013 Share Posted May 8, 2013 (edited) Hi, I am very new to using XML and making my first XML Schema. I want to write something in XML schema that will allow me to read a matrix. For example, I want to have a matrix that looks like this: <matrix > <row >2.1 3.4</row> <row >100.5 6.7</row> <row >-2.76 5.9</row> <row >-7.53 -30.21</row></matrix> All the values in this matrix will be decimals (no limits) and there will only be 2 values in each row. In addition, there is no restriction on the number of rows so when I am reading the XML, I want to continue reading until the last row is read. How will I write an XML schema that will allow me to verify this? So far I have got something like: <xs:element name="row" type="valuelist"><xs:simpleType name="valuelist"> <xs:list itemType="xs:decimal"/></xs:simpleType> I think this will allow me to read a row, but it doesn't let me place a limit of only 2 values in a row. And how would I read all the rows in a matrix? Thanks for your help!Alisha Edited May 8, 2013 by ay.a1234 Link to comment Share on other sites More sharing options...
Ingolme Posted May 10, 2013 Share Posted May 10, 2013 I'm not certain, but maybe the <length> restriction would work: http://www.w3schools.com/schema/schema_facets.asp If you had a set of <col> elements inside the <row> element, you could use the minOccurs and maxOccurs attributes to restrict the amount of columns you're allowed to add to the matrix. Schema doesn't "read" XML files, it's just there for validation so a user can know if they wrote the document properly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now