Error msg when validating with schema

This should cover W3C XML Schema, Relax NG and DTD related problems.
Douha
Posts: 17
Joined: Fri Aug 19, 2005 6:02 pm

Error msg when validating with schema

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hi,

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

Best Regards,
Sorin
Douha
Posts: 17
Joined: Fri Aug 19, 2005 6:02 pm

Post by Douha »

Thank you Sorin, that works.
Post Reply