com.nkutsche:xpath-model

This project contains an XPath parser and creates an XML model from it. The model can be used to make deeper analyzis, convert or serialize the expression to normalize XPath expressions.


License
MIT

Documentation

XPath XML Model

This project contains an XPath parser and creates an XML model from it.

Documentation Links

Basic Idea

The model can be used to make deeper analyzis, convert or serialize the expression to normalize XPath expressions.

An XPath normalizer could:

  • normalize ignoreable whitespace
  • remove/normalize ignoreable brackets
  • indention of the expressions

An analyzer could make statements abould:

  • used/unused functions or variables
  • validation of XPath version (I want to use XPath 2.0 only features though my processor supports 3.0)
  • used location steps (comparing to a given schema?)

A converter could manipulate given XPath expressions:

  • wrap all location steps by a function call
  • wrap all sub expressions by a function call
  • ...?

Standard conformance

  • The core parser in this project is generated based on the official EBNF file which defines XPath 3.1 using the REx Parser Generator (see Contribute).
  • There is an extra testing project that ensures that all valid expressions in the QT3 testsuite (~15k test cases):
    • are parsed to a valid model
    • can be parsed and re-serialized without any relevant changes.

Contribute

This project is based on the work of others. It uses: