This week's book giveaway is in the
We're giving away four copies of
and have Sam Newman on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
XML and Related Technologies
How to ensure some mandatory and some optional elements under complextype in xml?
Joined: Apr 05, 2011
Jun 11, 2012 10:03:07
I am facing problems in making a complex element, which allows both optional as well as mandatory elements.
For the xml below, say h2 is mandatory, while h1 is optional, and the order does not matter.
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="h1" minOccurs="0"></xs:element>
<xs:element name="h2" minOccurs="1" />
the third case above fails in this xsd, but such case is valid.
I need an xsd that is valid for all the above mentioned cases.
Joined: Jan 18, 2011
Jun 12, 2012 08:46:50
Like this or you mean something else.
<xs:element name="root"> <xs:complexType> <xs:all> <xs:element name="h1" minOccurs="0" /> <xs:element name="h2" /> </xs:all> </xs:complexType> </xs:element>
Have you checked out
subject: How to ensure some mandatory and some optional elements under complextype in xml?
Help me for xsd creation
Help in correcting a schema
To specify one of the value within XSD enumeration tag as mandatory
Unique particle attribution rule bit me - why?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015