[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is the advantage of RELAX in comparison to Schemas?
- From: James Clark <jjc@jclark.com>
- To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Tue, 30 Jan 2001 20:00:21 +0700
Inga Eckermann wrote:
>
> Hello,
>
> I am new to this list and have read about you mentioning RELAX and TRX.
> Why do I need these standards? On the RELAX-webpage is written:
>
> Compared with DTD(Document Type Definition), RELAX has new features:
>
> RELAX grammars are represented in the XML instance syntax
> RELAX borrows rich datatypes of XML Schema Part 2
> RELAX is namespace-aware
>
> Is it not all included in Schemas as well?
I can't answer for RELAX, but here are the areas I can think of where
TREX allows things that are difficult or impossible with the W3C's
schema language:
1. Attributes
In TREX, attributes are integrated into content models so that you can
specify, for example, that an element must have either attribute X or
attribute Y, or that it must have either attribute X or child element Y.
2. Wildcards
In TREX, you can specify a content model even when you use a wildcard
for the name of an element. One example of where this is necessary is
for literal result elements in XSLT. An element such as xsl:if can
contain, in addition to elements from the XSL namespace, literal result
elements, which are elements not from the XSL namespace; however, the
content of such literal result elements is subject to the same
constraints as the content of an element such as xsl:if. Another
example of where this is necessary is with XLink.
3. Mixed content
TREX imposes no restrictions on where the equivalent of #PCDATA can be
used in a content model. So, for example, it is possible accurately to
describe the OBJECT element in HTML (in which the PARAM elements should
precede other content).
4. Unordered content
The W3C's schema language has an "all" operator but it has severe
restrictions. TREX provides an "interleave" without any restrictions.
5. Intersection
TREX supports an intersection operator (called "concur"). This can be
used to implement exclusions (as in SGML).
6. Ambiguity
TREX has no restrictions on determinism/lookahead/ambiguity.
Have I left anything out?
However, I think a more important issue is how simple and easy to
understand the languages and their specifications are, but this is hard
to measure objectively.
James