[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Newbie - Schemas - Problem with minOccurs? or xmlns?
- From: Jeff Rafter <jeffrafter@earthlink.net>
- To: "Stout, Joel R" <Stout.Joel@emeryworld.com>
- Date: Tue, 24 Jul 2001 10:57:51 -0700
Joel,
There are a couple of problems I noticed in here:
> <?xml version="1.0"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://mymachine/schema.xsd"
> targetNamespace="http://mymachine/schema.xsd"
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
Becuase you are using the schema namespace as the default, you must prefix
you targetNamespace references: add xmlns:my="http://mymachine/schema.xsd"
in here.
> <complexType name="record">
> <sequence>
> <element name="cname" type="xsd:string"/>
Again, the schema namespace is the default-- so these should be "string"
with no prefix.
> <element name="email" type="xsd:string"/>
> </sequence>
> </complexType>
> <element name="addressBook">
> <complexType>
> <sequence>
> <element name="owner" type="record"/>
Follwing the same problem, references to your targetNamespace types must be
prefixed so change this to "my:record"
> <element name="person" type="record"
> minOccurs="8" maxOccurs="unbounded"/>
> </sequence>
> </complexType>
> </element>
> </schema>
Oftentimes (especially when starting out) it is easier to prefix the schema
namespace with "xs:" or "xsd:". There are some examples in the schema
primer that do this. This is really personal preference though... Based on
the errors in the schema I am guessing it was not checked-- this may be
because it couldn't recognize the type "record" and just pursued lax
validation-- but if so, that seems like a bug to me... I would check your
validation code.
Good Luck,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting