TREX has been merged with RELAX to create RELAX NG. All future development of
TREX will take place as part of the RELAX NG effort. Many of TREX
resources on this page are already available for RELAX
NG. The remainder will be converted in the near future.
TREX - Tree Regular Expressions for XML
TREX is a new language for validating XML documents.
I suggest you start by reading the tutorial. This assumes some familiarity with
XML and XML namespaces. This article on XML
namespaces would be useful background. There is also a (relatively)
formal specification; this aims to be rigorous
and concise; it is not light reading.
The following supporting resources are also available.
- A sample implementation in Java. This is
written on top of SAX2.
- An XSLT stylesheet that converts from
RELAX Core into TREX. This should be able to handle any correct RELAX
module, but it does not implement the RELAX semantic of implicitly
allowing undeclared attributes. (However, the sample implementation is
capable of recovering from such errors.) Handling the RELAX include
feature requires an extension over XSLT 1.0; the stylesheet can
currently use the extensions implemented in either MSXML or SAXON; it
can be easily adapted to any other conforming XSLT processor that
supports a result tree fragment to node set conversion function. No
extension will be required for XSLT 1.1. This stylesheet will not work
with XT, since XT does not implement keys. There's also an auxiliary stylesheet that removes from
redundancies generated by the previous stylesheet.
- A TREX pattern for TREX.
- A TREX pattern for XSLT 1.0 stylesheets.
- An implementation of XHTML modularization in
TREX.
- A TREX pattern for RELAX Core. This
was generated using the above stylesheets from (a slightly bug-fixed
version of) the RELAX module for RELAX core.
- A TREX pattern for the XML Spec DTD
2.0. This was again generated from the RELAX module using the above
stylesheets.
- A TREX pattern that customizes the XML
Spec TREX pattern to match the XML source
of the XPath 1.0 Recommendation.
- A TREX pattern for the language defined
by the XLink Proposed
Recommendation. This disallows uses of XLink constructs that do
not have an XLink-defined meaning.
The following resources are available elsewhere.
TREX expects to partner with a datatyping language, such as XML Schema Part 2:
Datatypes.
Related work includes:
James Clark