[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XML won't validate against schema
- From: Martin Gudgin <marting@develop.com>
- To: majormit@WORLDNET.ATT.NET, Danny Ayers <danny@panlanka.net>,Xml-Dev <xml-dev@lists.xml.org>
- Date: Mon, 16 Apr 2001 18:14:51 +0100
A few things spring to mind;
1. XMLSpy doesn't like minOccurs='0' on the xsd:all element ( validate
the schema doc to get this info ) ( 0 is a valid value according to the
latest spec BTW )
2. Valid values of maxOccurs on an xsd:all are either 0 or 1. unbounded
is not allowed ( line 495 )
3. All that being said, it still doesn't work although changing the
xsd:all elements to xsd:sequence fixes the immediate problem ( and would
allow values other than 1 or 0 for min/maxOccurs ). I suspect XMLSpy has a
problem with xsd:all here.
You will also need to reorder subclass and class on lines 47 and 48 of
instance doc because of the change to sequence. Also change the date value
on line 64 and 69 to read 2000-01-01 ( YYYY-MM-DD ), provide a time value on
line 65 and 70 and change the value of the duration element on line 80 to
PT20H3M0S ( assuming you wanted a duration of 20 hours and 3 minutes ). In
addition the base type for the anonymous simpleType inside the element
declaration of discount_type should ( I think ) be xsd:string rather that
xsd:byte.
Fixed schema is at[1]. Fixed instance is at[2]
Regards
Martin Gudgin
[1] http://marting.develop.com/xsd/tso_market.fixed.xsd
[2] http://marting.develop.com/xsd/tso_sample.fixed.xml
----- Original Message -----
From: "Tim Greiner" <majormit@WORLDNET.ATT.NET>
To: "Danny Ayers" <danny@panlanka.net>; "Xml-Dev" <xml-dev@lists.xml.org>
Sent: Monday, April 16, 2001 5:46 PM
Subject: XML won't validate against schema
> The .xsd and .xml files are attached. XMLSpy says the xml file is not
valid
> because of mandatory elements 'name' and 'phone' in 'contact'. however
those
> elements are there and have data in them.
>
> Thanks
>
> Tim
>
> Can you please post the schema & doc. Unless it's an instantly
recognisable
> XMLSpy bug, there's not a lot to go on here.
>
> ---
> Danny Ayers
> http://www.isacat.net
>
> <- -----Original Message-----
> <- From: Tim Greiner [mailto:majormit@WORLDNET.ATT.NET]
> <- Sent: 16 April 2001 20:37
> <- To: Xml-Dev
> <- Subject: XML won't validate against schema
> <-
> <-
> <- Hi all...newbie here trying to validate an xml doc against a
> <- schema I built
> <- with XMLSpy. The schema contains a required element with some
> <- optional and
> <- required children. However, the XMLSpy validator says the file
> <- is not valid
> <- (Mandatory elements expected in 'contact' after 'phone': name, phone)
> <-
> <- 'contact' is the reqd element and 'phone' and 'name' are the
> <- reqd children
> <- of contact. I have entered data in for name and phone but am
> <- still getting
> <- the not valid msg...anyone seen this?
> <-
> <- Thanks
> <-
> <- Tim
> <-
> <-
> <- ------------------------------------------------------------------
> <- The xml-dev list is sponsored by XML.org, an initiative of OASIS
> <- <http://www.oasis-open.org>
> <-
> <- The list archives are at http://lists.xml.org/archives/xml-dev/
> <-
> <- To unsubscribe from this elist send a message with the single word
> <- "unsubscribe" in the body to: xml-dev-request@lists.xml.org
> <-
>
>