Priscilla Walmsley wrote:
Hi,
You almost had it. You need an extra xs:simpleType element in there.
Also, you don't want to use itemType - it's an either/or thing - either
you specify the itemType attribute OR a simpleType child.
<xs:element name="ABNFRULES ET" type="xs:token" maxOccurs="1">
<xs:simpleTyp e>
<xs:list>
<xs:simpleTyp e>
<xs:restricti on base="xs:token" >
<xs:pattern value="\p{IsBas icLatin}*"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
</xs:element>
Some more examples of list types are at:
http://www.datypic.com/books/defxmls...chapter11.html
Hope that helps,
Priscilla
----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
XQuery
http://www.datypic.com
----------------------------------
Thanks Priscilla Actually I figured this out before I saw your post but
now I have a bigger problem
I have now fully composed my xsd which is as follows
=============== =============== =============== =============== ====
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace ="http://www.w3schools.c om"
xmlns="http://www.w3schools.c om" elementFormDefa ult="qualified" >
<xs:element name="PROTOHEAD ERENTRY">
<xs:complexType >
<xs:sequence>
<xs:element name="ABNFGRAMM ER" minOccurs="1" maxOccurs="1">
<xs:complexType >
<xs:sequence>
<xs:element name="ABNFRULES ET" maxOccurs="1">
<xs:simpleTyp e>
<xs:list>
<xs:simpleTyp e>
<xs:restricti on base="xs:token" >
<xs:pattern value="\p{IsBas icLatin}*"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
</xs:element>
<xs:element name="ABNFEXCEP TION" maxOccurs="unbo unded">
<xs:complexType >
<xs:attribute name="RULENAME" type="xs:token"/>
<xs:attribute >
<xs:simpleTyp e>
<xs:restricti on base="xs:token" >
<xs:enumerati on value="MANDATOR Y"/>
<xs:enumerati on value="IGNORESE Q"/>
<xs:enumerati on value="IGNORECA SE"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="NAME" type="xs:token"/>
<xs:attribute name="HEADERSEQ NUM" type="positiveI nteger"/>
</xs:complexType>
</xs:element>
<xs:element name="ABNFBASIC ">
<xs:complexType >
<xs:sequence>
<xs:element name="RULESTRIN G" type="xs:string " maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="ABNFBASIC NAME" type="NMTOKEN"/>
</xs:complexType>
</xs:element>
<xs:element name="ABNFRULE" >
<xs:complexType >
<xs:sequence>
<xs:element name="RULESTRIN G" type="xs:string " maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="RULENAME" type="NMTOKEN"/>
</xs:complexType>
</xs:element>
<xs:element name="PROTOHEAD ER">
<xs:complexType >
<xs:attribute name="PROTOHEAD ERNAME" type="xs:token"/>
<xs:attribute name="ENTRYSEQN UM" type="xs:positi veInteger"/>
</xs:complexType>
</xs:element>
<xs:element name="PROTODEF" >
<xs:complexType >
<xs:sequence>
<xs:element name="PROTOTABL E">
<xs:complexType >
<xs:sequence>
<xs:element ref="PROTOHEADE R" maxOccurs="unbo unded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="PROTOHEADE RENTRY" maxOccurs="unbo unded"/>
<xs:element ref="ABNFRULE" maxOccurs="unbo unded"/>
<xs:element ref="ABNFBASIC" maxOccurs="unbo unded"/>
</xs:sequence>
<xs:attribute name="PROTOCOLN AME" type="xs:token"/>
<xs:attribute name="PROJECTNA ME" type="xs:string "/>
</xs:complexType>
<xs:key name="KEYHEADER NUM">
<xs:selector xpath="PROTOHEA DERENTRY"/>
<xs:field xpath="HEADERSE QNUM"/>
</xs:key>
<xs:keyref name="KEYENTRYN UM">
<xs:selector xpath="PROTOHEA DER"/>
<xs:field xpath="ENTRYSEQ NUM"/>
</xs:keyref>
</xs:element>
</xs:schema>
=============== =============== =============== =============== ===
And now when I give it to the validator I get the following
=============== =============== =============== =============== =
For attribute '???', either the name or the ref attribute must be
present, but not both.
If ref is present, all of 'simpleType', 'form', 'type', and 'use' must
be absent.
The referring attribute must be present.
=============== =============== =============== =============== =
This is the web based validator at the w3school site and it doesnt show
the line numbers so I cant figure out where exactly is the problem.
Ant help will be appreciated
Also can someone point me to a good freeware which can validate xsd
thanks
Shyam