DTD to Schema (W3C): Is it possible to combine datatyping at element level and attribute value speci

I

Ingrid

Am I right in thinking that datatyping at element level ie <xs:element
name="num" type="xs:integer">

and specifying a choice of attribute values ie

<xs:attribute name="kind">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="volume_number"/>
<xs:enumeration value="page_range"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>

.......does not go together??????

**************************

Setting out to convert the following DTD element specification...
<!ELEMENT num (#PCDATA | emph)*>
<!ATTLIST num
kind (volume_number | page_range) #REQUIRED>

.... into Schema....
<xs:element name="num">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="emph"/>
</xs:sequence>
<xs:attribute name="kind" use="required">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="volume_number"/>
<xs:enumeration value="page_range"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>

..... I realised, that if I want to make use of the additional
datatyping capabilites of Schema (ie adding a datatype of xs:integer
to the element "num" to allow numerical element content only, for
example), I cannot at the same time specify a choice of required
attribute values, i.e. volume_number and page_range for this element.
As soon as I give the element a datatype
ie <xs:element name="num" type="xs:integer"> no further child element
or attribute specifications are allowed...

I know I can set the integer at the attribute level, which means that
the data needs to be entered within the <num ...."31"> tag rather
than between an opening and closing
<num kind="volume_number">31</num>
but the element is part of a digitisation project template for
transcribers and the idea is, to set up the template in such a way
that it can check data entry at element level, ie keyers only need to
enter data between element tags, not at attribute level....

I guess I am stuck with adding child elements to the <num> element ie
<volume_number> <page_range> and add some datatyping to these...???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top