|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: A single, all-encompassing data validation language- good
Hi, Playing with Schematron with W3C XML Schema in separate steps or with annotations or in a way such as the latter adopts the former won't change anything : you'll still have more or less a separation of them, and they will cooperate in the same manner than today : check the grammar then check the assertions, or perhaps the opposite ? The major drawback is that Schematron can't act on the content model instead of what does grammar-based schema (that build them) ; thus, if an editor will propose to the user to insert some elements, maybe few of them will be rejected by Schematron after inserting them The key point is how content models are built : as schema instances are hard-coded XML documents, abstract trees built by schema processors are statics ; why not making them dynamic ? I saw in this list some intersting examples about co-occurrence constraints and algorithmic validation, taken from www.xfront.com for example : <Document classification="confidential"> <Para classification="unclassified"> One if by land, two if by sea; </Para> <Para classification="confidential"> And I on the opposite shore will be, Ready to ride and spread the alarm </Para> <Para classification="secret"> Ready to ride and spread the alarm Through every Middlesex, village and farm, </Para> <Para classification="top-secret"> For the country folk to be up and to arm. </Para> </Document> The 2 last <Past> are invalid because the classification level must be under "confidential", as it has been specified on <Document> I made a single schema somewhat simple that build dynamically the list of text values for the attribute : -"confidential", "unclassified" are the allowed values in this case My schema simply report a "bad attribute value" for the <Para>s in fault if "top-secret" had been specified on <Document>, the list would be : -"top-secret", "secret", "confidential", "unclassified" here is the stuff : http://reflex.gforge.inria.fr/tutorial-schemas.html#classificationLevel You can download the engine and run it yourself... There was another example : <ElectionResultsByPercentage> <Candidate name="John">61</Candidate> <Candidate name="Sara">24</Candidate> <Candidate name="Bill">15</Candidate> </ElectionResultsByPercentage> the constraint is that the sum of percentage must be 100 I designed a schema that impose a <Candidate> element if the sum is not yet reached, and that report an error if the sum is exceeded ; in all cases, the job is done in the content model http://reflex.gforge.inria.fr/tutorial-schemas.html#activeSchemaAlgo The last but not the least, there are still things that can't be done by Schematron (and neither by W3C XML Schema nor Relax NG nor DTD) ; for example, to design semantic data types Here is an example of what is possible : http://reflex.gforge.inria.fr/tutorial-schemas.html#psvi There is a new way to make schemas, this is the Active Schema Language : ASL can build active content models, that is to say content models that can adapts themselves according to the input to validate. Doing these things dynamically is much more powerful and efficient than the traditional approach. I will talk few minutes about the Active Schema Language at Extreme Markup Language next week : http://www.extrememarkup.com/2007/abstracts.html#t400r -- Cordialement, /// (. .) --------ooO--(_)--Ooo-------- | Philippe Poulard | ----------------------------- http://reflex.gforge.inria.fr/ Have the RefleX !
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||







