XML Schema Semantics validation

P

pal.girish

Hi,
I am totally new to XML. I would like to know is there any way to
enforce rules in XML through XML schema such that value of one
attribute in some elemnet is validated against values of other
attributes in other elements. For eg
if
<fruit name=apple cost=5>
</fruit>
<fruit name=grapes cost=10>
</fruit>

now i need to check that cost of grapes is always greater than apple
can i do it through XML schema or I will need to parse the tree using
some programming language and then do all these types of validations

Thanks,
Girish
 
M

Martin Honnen

if
<fruit name=apple cost=5>
</fruit>
<fruit name=grapes cost=10>
</fruit>

now i need to check that cost of grapes is always greater than apple
can i do it through XML schema or I will need to parse the tree using
some programming language and then do all these types of validations

XSD schemas can't express such constraints relating to different
attribute values. You can express such constraints with the Schematron
language, see <http://www.schematron.com/>.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top