- From: Eddie Robertsson <eddie@allette.com.au>
- Date: Fri, 14 Dec 2001 17:37:53 +1100
- To: Kumeda <kumeda@atc.yamatake.co.jp>
- CC: xmlschema-dev@w3.org
Hi Kumeda, > file:/usr/local/XSV/xsvlog/@3517.4uploaded:4:1: > Invalid per cvc-complex-type.1.3: undeclared attribute > {None}:maxOccurs > > What is wrong with my schema? The error message is a bit obscure and doesn't really explain what the problem is. Your problem is that you cannot place occurence constraints on global element and attribute definitions. In your schema you have the global element contact with a maxOccurs attribute which is not legal so remove the occurence constraint and you should be ok. If you want to have up to 99 contact elements in the instance document then you have to wrap them in a single root element like for example: <xsd:element name="contacts"> <xsd:complexType> <xsd:sequence> <xsd:element name="contact" type="means" maxOccurs="99" /> </xsd:sequence> </xsd:complexType> </xsd:element> Since you're using a targetNamespace you also need to add a namespace declaration for this namespace. This can for example be a default namespace declaration on the <xsd:schema> element like this: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.xmlforia.org" xmlns="http://www.xmlforia.org"> Cheers, /Eddie > ----- The schema just validated and got an error ------ > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://www.xmlforia.org"> > > <xsd:element name="contact" type="means" maxOccurs="99" /> > > <xsd:simpleType name="means"> > <xsd:union memberTypes="email fax" /> > </xsd:simpleType> > > <xsd:simpleType name="email"> > <xsd:restriction base="xsd:string"> > <xsd:pattern value="[a-z]@[a-z0-9]+" /> > </xsd:restriction> > </xsd:simpleType> > > <xsd:simpleType name="fax"> > <xsd:restriction base="xsd:string"> > <xsd:pattern value="\d+-\d+-\d+" /> > </xsd:restriction> > </xsd:simpleType> > </xsd:schema> > > -- > Kumeda, Yasuo TEL: +81-466-20-2430 > FAX: +81-466-20-2431 > Research and Development Headquarters > Yamatake Corporation > > Fujisawashi Kawana 1-12-2 > Kanagawa, 251-8522 JAPAN
Received on Friday, 14 December 2001 01:29:05 UTC