Content Constraints in Table Rows

Hi folks,

I have a question concerning a schema for storage of table based data in
XML.

We'd like to store data in a structure like this:
<tablename type="table">
  <row>
    <col1>0.0</col1>
    <col2>3220</col2>
    <col3>0.329</col3>
  </row>
  <row>
    <col1>0.34</col1>
    <col2>46897</col2>
    <col3>0.3198</col3>
  </row>
  <row>
    <col1>1.0</col1>
    <col2>4686</col2>
    <col3>0.1687</col3>
  </row>
</tablename>


While this looks simple I need a schema to check the contents of one (or
more) column elements to have certain values or be within a range of values
(mostly numeric) for certain rows respectively.
Lets say the first column must begin with (1st row) "0" and end with (last
row) "1". All intermediate rows must contain values >"0" and <"1".
To achieve this we have now defined three different types of rows, like
"firstRow", "middleRow", and "lastRow". However, I have a feeling that this
is not the most elegant way.

So is it possible to define a single type "Row" type with an attribute like
"position" which can be "first"/"middle"/"last" and use it to check the
content?

I'd appreciate any help, thanks.

Regards
Daniel.

Received on Tuesday, 15 April 2003 03:04:31 UTC