[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Is Schematron (using XPath 2.0) functionally a superset ofXML Schemas?
- From: noah_mendelsohn@us.ibm.com
- To: Rick Jelliffe <rjelliffe@allette.com.au>
- Date: Mon, 12 Nov 2007 15:40:38 -0500
I wonder if it's useful to point participants in this discussion to The
Rule of Least Power [1]. Although my name is on it, the ideas trace
mainly to Tim. I was asked at one point to help him edit and clean up the
document for production as a TAG finding. Anyway, I think it's pertinent
in pointing out that there are tradeoffs in choosing these languages,
depending on the goals. Let me posit, for the moment that a) Schematron
is informally more powerful than XSD in the sense that there are a lot of
constraints that are useful to some users that you can express
straightforwardly in Schematron that you either can't express at all or
can't express conveniently in XSD and 2) that with XSLT2 and XPath 2
Schematron may be strictly more powerful than XSD content models, in the
sense that for every constraint expressible in XSD there is at least one
way to say it in Schematron. I think that's all probably true, but if
not, let's assume it and give Schematron the benefit of the doubt for the
moment.
What got me thinking about the Rule of Least Power was:
Michele Vivoda wrote:
> I use the schema also for its data-description
> features: to know which element/attrs are allowed,
> datatype etc, before validation,
> to _produce_ instances, that then I will validate.
>
> I think that it would be hard to
> get the same description from a list of xpaths,
> or at least I wouldn't know where to start.
>
> Is it possible to go back from the schematron
> to the w3c schema ?
There tends to be a tradeoff between using languages that are more
powerful or expressive vs. being able to figure out easily what's being
said. So, whatever its other pros and cons, it's pretty simple at the XSD
component level to express that element E has a type T that allows just a
sequence (A,B,C). So, if Michele wants to write tools that figure out in
closed form the instances that are allowed, or to drive user interface
generators that will prompt for the right content, I suspect that will in
many cases be easier to do with XSD. Of course, simple expressions in any
language are easy to recognize, but I expect that there are quite a few
ways of saying in Schematron that E allows A,B,C, and the tools would have
to recognize at least the common ones.
For the record, The Rule of Least Power Finding [1] raises these issues
primarily in the context of resource representations on the Web, for which
it's almost always good to use the weakest language that will do: if your
Web data is declarative (HTML, XML, etc.) then tools like Google spiders
can grok it to find the text, the links, etc.; if it's imperative or
Turing complete (think Flash .swf files), then that's hard. I'm not
making the case that for schemas the weaker language is in general better,
just that it's a tradeoff.
Noah
[1] http://www.w3.org/2001/tag/doc/leastPower.html
--------------------------------------
Noah Mendelsohn
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]