I have two more questions on XML-schema that need your help:
1. Is there any way to represent an array?
I know that the schema recommendation does not support this yet. But I
want to find a best solution for this if possible. For example, my code
has a variable:
String title[numberOfTitle], where
numberOfTitle is not known as a priori when schema author
developed it. The numberofTitle is of type xsd:integer
designed in schema, and its value will be given by user in an xml
document instance, but when the user supplies this data, schema must
validate that the maxOccurs can only be numberOfTitle data items.
How to design such an schema? In such a situation, do I have to resort to
XPATH?
2. My second question is about type choice. Below is part of my
schema:
<xsd:element name="DataValue"> <!--
data can be either float or double--> <xsd:complexType>
<xsd:choice>
<xsd:element name="Data" type="xsd:float"
minOccurs="1" maxOccurs="unbounded"/>
<xsd:element name="Data" type="xsd:double"
minOccurs="1" maxOccurs="unbounded"/>
</xsd:choice>
<xsd:attribute ref="dataType" use="required"
/> </xsd:complexType>
</xsd:element>
But I want more constraints on this schema --- when user supplies the
attribute dataType to be "float", the schema will only allow
the instance document to supply Data Element to be of type xsd:float; on
the other hand, if attribute dataType is "double", the XML
document can only supply Data Element of type
xsd:double?