XPath over XML Schema

Timeframe:03.2006 - 08.2006
Supervisor: Eric Wohlstadter
Language:Java 5

Description: The primary purpose of this software is to address parts of an XML Schema document with an XPath 1.0 expression written for instances of that Schema. The library may be used, for example, to get at compile-time an approximate set of nodes that will be matched at run-time.
A special feature of the XPathOverSchema library is the ability to evaluate one XPath in the context of results of another XPath expression. Another useful extra feature is the ability to get line/column and file offset of a matched node.

Levels of Support of XPath 1.0 Features
(W3C XPath 1.0 Specifications can be found here)

Nodes
The supported types of nodes are element, attribute, and text. Namespace, processing instruction, and comment nodes are not supported. The expression is evaluated into a possibly empty set of matched nodes.

Axes
The following axes are supported: child, descendant, parent, ancestor, following-sibling, preceding-sibling, following, preceding, attribute, self, descendant-or-self, ancestor-or-self. The following axes is not supported: namespace.

NodeTests
NameTests, text(), and node() are supported. processing-instruction() and comment() are not supported.

Predicates
The only type of predicate supported is the relative node test. For example, one might select all nodes A that have both children X and Y using the query "//A[./X][./Y]".
Note, that an XPath within a predicate is always analysed in the context of its step node, even if it is absolute (starts with "/"). So, "/A[/X]" is equivalent to "/A[./X]" (the predicate tests that A has a child X, not that the document root has a child X).

Abbreviated Syntax
Supported, including * // . .. @

Functions
Not supported

Variable bindings and references, namespace declarations
Not supported. Namespace declarations occur externally (in Java code).

Summary of Current Limitations
1. XML Schemas must have targetNamespace attribute defined and non-empty.
2. The namespace axis is not supported.
3. Namespace, processing instruction, and comment nodes are not supported.
4. The only type of predicate supported is the relative node test.
5. Variables and functions are not supported.

Required software
To work with XPathOverSchema you need additional software.
To simplify installation and operation of XPathOverSchema an additional ZIP file is provided that holds all other JARs that are required. Please note that we probably not use the very latest versions of these JARs, but we used them during the tests.
1. XPath expressions are parsed using SaxPath library (part of Jaxen).
2. XML Schema documents are parsed into OO entities using XMLBeans 2.1 or better.
3. JSR-173 API library is required by the XMLBeans.

Downloads: Source, binary (JAR), and required JARs are available from SourceForge
Ivan Minevskiy

minevskiydotgmail.com