XML Schema for 2 Dimensional Table

This should cover W3C XML Schema, Relax NG and DTD related problems.
dbaechtel
Posts: 3
Joined: Wed Oct 18, 2006 6:14 pm

XML Schema for 2 Dimensional Table

Post by dbaechtel » Thu Feb 07, 2008 5:59 pm

I am using Oxygen 8.2 to develop a Schema for a Database. I have come across a need to describe a Two Dimensional Table with an unbounded number of Rows and Columns and Cells for each Row and Column combination. I know how to use xs:sequence to describe a 1 dimensional list. But what is the best way to describe a 2 dimensional table with NxM cells in an XML Schema?

Any Help is greatly appreciated.
:?
Don Baechtel

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: XML Schema for 2 Dimensional Table

Post by sorin_ristache » Thu Feb 07, 2008 6:23 pm

Hello,

You can define a row of the table as a sequence of maximum maxColumnNumber cells. You have to replace maxRowNumber and maxColumnNumber with real numbers.

Code: Select all

<xs:element name="table">
<xs:complexType>
<xs:sequence maxOccurs="maxRowNumber">
<xs:element name="row">
<xs:complexType>
<xs:sequence maxOccurs="maxColumnNumber">
<xs:element ref="tableCellType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Regards,
Sorin

dbaechtel
Posts: 3
Joined: Wed Oct 18, 2006 6:14 pm

Re: XML Schema for 2 Dimensional Table

Post by dbaechtel » Thu Feb 07, 2008 6:37 pm

Thanks! :)
Don Baechtel

Post Reply