This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes W3C XML Schema Fundamentals? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "W3C XML Schema Fundamentals?" Watch "W3C XML Schema Fundamentals?" New topic
Author

W3C XML Schema Fundamentals?

Adnan Memon
Ranch Hand

Joined: Mar 09, 2003
Posts: 32
how can we do following in w3c xml schema?

1. a tag must contain data

2. a attribute in set of tags must have atleast some specified value.
e.g
<element name="option" maxOccurs="8">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="correct" type="boolean" use="optional" default="false"/>
</extension>
</simpleContent>
</complexType>
</element>
Out of these max 8 tags one must contain correct="true". How to enforce it.

3. is it safe to use 0 for false and 1 for true
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
1. a tag must contain data

This should work:


2. a attribute in set of tags must have atleast some specified value. ... Out of these max 8 tags one must contain correct="true". How to enforce it.
I would try the <xs:all> element (somehow, don't know exactly how).

3. is it safe to use 0 for false and 1 for true

Could you elaborate a bit on this?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: W3C XML Schema Fundamentals?
 
Similar Threads
override an attribute from parent element?
how does xml look like for this schema ?
why Axis doesn't preserve Inheritance ?
Doubt on schema extension for String
Jasper Reports Cookbook- userdefined XML to PDF possible