XPath over XML Schema
Downloads Examples
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.

Latest Release: 1.1 [March 9, 2008]

Dependencies (XmlBeans 2.1, Jaxen 1.1b8, JSR 173 1.0): all-in-one zip
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
  • XML Schemas must have targetNamespace attribute defined and non-empty.
  • The namespace axis is not supported.
  • Namespace, processing instruction, and comment nodes are not supported.
  • The only type of predicate supported is the relative node test.
  • 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.

SourceForge.net Logo Hit Counter