File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: W3C XML Schema Fundamentals?