Page 1 of 1

Error msg when validating with schema

Posted: Fri Aug 19, 2005 6:09 pm
by Douha
Hi all,

I am trying to validate an xml file using a an w3 schema. Here is the namespace line for the schema. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">

The xml file that I am validating does not contain a couple of fields that are defined in the schema. When I do the validation, I get this message;
cvc-complex-type.2.4.a: Invalid content was found starting with element.

How do I code the schema to show that some of the fields are not mandatory?

Thanks,

Doug Harding
State of Utah / Division of Finance

Posted: Mon Aug 22, 2005 2:36 pm
by sorin_ristache
Hi,

Use the choice element or the minOccurs="0" attribute.

Best Regards,
Sorin

Posted: Mon Aug 22, 2005 5:43 pm
by Douha
Thank you Sorin, that works.