Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

add constraints on two elements in schema - need help..

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two elements in the schema:
< Item > and < Price >. Is there a way to add constraints on both these elements in the foll. manner:
Item can have the values "One" and "Two".
If Item="One" then Price="100"
else if Item="Two" then Price="200".
I understand the basics of schema like the complexType, the Sequence, the simpleType etc and
am tying to learn some complex stuff.
This is not a requirement but I want to design
it this way.
Any help is appreciated.
Thanks.
- madhav
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't tried the if then part,, but if you want to restrict the datas for item and price to one,two and 100,200 respectively then you try this schema

[ January 17, 2003: Message edited by: Balaji Loganathan ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Balaji. I got the restriction and enumaration part done.
I didn't tried the if then part,,
With all the fuss that schema's can do this do that....I am trying to know how to do complex expressions...hope someone can point me in the right direction.
Sometimes, its frustrating to accept that I am lagging so far behind the rest of the world.... :roll:
regds.
- madhav
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
knock..............knock...please...
Thanks.
- madhav
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope you have the Schema tutorial of Henry thomson or Roger which is available at http://www.cogsci.ed.ac.uk/~ht/tutorials.html
thats the only good one i have for schema.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Madhav Lakkapragada:
knock..............knock...please...
Thanks.
- madhav

the other option could be to use a validator to check this (if then) constraints, for example a small XSLT can do this checking job. But its depends on ur business case.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic