- From: Priscilla Walmsley <priscilla@walmsley.com>
- Date: Wed, 17 Apr 2002 10:09:30 -0400
- To: "'Marko Asplund'" <aspa@kronodoc.fi>
- Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Ah, I see. What you are trying to do is both restrict and extend (by adding attributes) at the same time. You actually have to do this in two steps, so it would look something like this: <xsd:simpleType name = "shortString"> <xsd:restriction base = "xsd:string"> <xsd:maxLength value = "1024"/> <xsd:minLength value = "0"/> </xsd:restriction> </xsd:simpleType> <xsd:element name = "EXT"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base = "shortString"> <xsd:attribute name = "IDREF" use = "required" type = "xsd:IDREF"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> Hope that helps! Priscilla ------------------------------------------------------------------------ ----- Priscilla Walmsley priscilla@walmsley.com Author, Definitive XML Schema (Prentice Hall PTR) ------------------------------------------------------------------------ ----- -----Original Message----- From: Marko Asplund [SMTP:aspa@kronodoc.fi] Sent: Wednesday, April 17, 2002 6:43 AM To: Priscilla Walmsley Cc: 'xmlschema-dev@w3.org' Subject: RE: schema validation error On Tue, 16 Apr 2002, Priscilla Walmsley wrote: > I've seen this message before, when you are trying to restrict a simple > type to result in a complex type with simple content. For example, if the > type for one of your elements looks like: > > ... > It should really be: > > <xs:element name="EXT"> > <xs:simpleType> > <xs:restriction base="xs:integer"> > <xs:minExclusive value="1"/> > </xs:restriction> > </xs:simpleType> > </xs:element> thanks very much for your answer. the above schema fragment seems to work but it misses an attribute declaration. the relevant part of the original schema is as follows: <xsd:element name = "EXT"> <xsd:complexType> <xsd:simpleContent> <xsd:restriction base = "xsd:string"> <xsd:maxLength value = "1024"/> <xsd:minLength value = "0"/> <xsd:attribute name = "IDREF" use = "required" type = "xsd:IDREF"/> </xsd:restriction> </xsd:simpleContent> </xsd:complexType> </xsd:element> how do i add the attribute declaration to your schema fragment? best regards, -- aspa
Received on Wednesday, 17 April 2002 10:06:54 UTC