- From: Paul Warren <pdw@decisionsoft.com>
- Date: 23 May 2003 11:26:32 +0100
- To: Arvind M Patil <arvind.patil@majoris.com>
- Cc: xmlschema-dev@w3.org
On Fri, 2003-05-23 at 10:03, Arvind M Patil wrote: > Can I define a business rules in xml schema definition. > > For example: Consider a sample xml definition > > <employee> > <name>xyz</name> > <age>30</age> > <maxServiceAllowed>28</maxServiceAllowed> > <maxAge>58</maxAge> > </employee> > > So based on this hypothetical information, I wanted to have validation > rule in schema such away that > maxServiceAllowed = maxAge - age > > Can I acheive this in schema? Thanks for attention. No, is the simple answer. XML Schema does not provide for this sort of cross-field validation. The most common way to implement this is to use a Schematron [1] schema in addition to an XML Schema. There is some discussion of including co-constraints into XML Schema 1.1 [2], but as I understand it this will be limited, if included at all, and still may not cover the case above at all. My company provides XML validation tools, so how to handle rules such as the above has been a subject of interest to us for some time. We recently put together a paper[3] on how additional business rules might incorporated into XML Schema. This was more a hypothetical investigation into how it might work, rather than a real proposal, in order to drive the future development of our products. Interestingly, I recently came across a Sun tool [4] that allows Schematron rules to be integrated with Relax NG schemas in a way that overcomes some of the problems associated with embedding Schematron rules into XML Schema. Paul [1] http://www.ascc.net/xml/resource/schematron/schematron.html [2] http://www.w3.org/TR/2003/WD-xmlschema-11-req-20030121/#N40011D [3] http://www.decisionsoft.com/pdw/busRules.pdf [4] http://wwws.sun.com/software/xml/developers/schematronaddon/ -- Paul Warren, Client Services DecisionSoft Limited +44-1865-203192 http://www.decisionsoft.com
Received on Friday, 23 May 2003 06:27:28 UTC