Click here to Skip to main content
12,697,545 members (28,309 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET XML
hello friends

i have one schema
which contain element like

<xs:element minOccurs="0" name="employee" nillable="true" maxOccurs="2" type="xs:string"/>

I have one xml file with no element named "employee". As per xml schema minOccurs is Zero(0), so validation should not fail.

But if there isn't any employee element, I get error in validate.

How can i solve it

please help
Posted 30-Jul-12 8:31am
Updated 31-Jul-12 5:08am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

hi PKriyshnA.
have you tried this:

<xs:element name="employee">
     <xs:all minOccurs="0">
       <xs:element name="FirstN" type="xs:string"/>
       <xs:element name="LastN" type="xs:string"/>

The example above indicates that the "firstname" and the "lastname" elements can appear in any order and each element CAN appear zero or one time!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 31 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100