[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XML Encoding of XPath: Examples
- From: Rick Jelliffe <firstname.lastname@example.org>
- To: email@example.com
- Date: Sun, 18 Mar 2001 17:06:16 +0800
From: Murata Makoto <firstname.lastname@example.org>
>In the string case, regular expressions and finite automata (or regular
>grammars) look very different, but they are equally expressive.
>In the tree case, we have a similar result. The expression approach
>such as XPath (and thus Schematron) and the automaton approach such
>as RELAX and TREX are inherently equivalent.
I disagree. Sort of. They are equivalent only from a theoretical and
As long as Xpaths are not as powerful as regexes by not having grouping or
reptition, and as long as regexes do not allow full XPaths for particles,
current grammar-based and path-based systems are not remotely equivalent in
And it is the higher-level abstractions which the schema uses to model
things that give much of the value of language. Schematron has no notion of
type. XML Schemas has no equivalent to Schematron's pattern. To say
"equivalent" may confuse people that the equivalence is the same equivalence
as saying "C# is equivalent to Java" rather than "a C++ program is
equivalent to its binary compiled form": equivalence does not mean
equivalently useful or useable or congenial.
For example, lets have a pattern called "three equal sized arrays in three
documents" with the definition "the number of children in element X in this
document should be the same as the number of children of element Y in that
document (URL given in the attribute @Y on the X element in this document)
and it should be the same as the number of children of element Z in another
document (URL given as the attribute @Z on the X element in this document)."
I could easily write an Schematron schema for that in a couple of lines. How
would a conventional grammar-based schema language express that?