# Design notes on the XPath 2.0 and XQuery Data Model

The purpose of this document is to express the requirements of the XPath data model in Eiffel terms. This makes it easier to see what is needed, and whether compatibility with the exisiting tree structure can be maintained.

I have written a class skeleton for each of the seven XPath node types. In addition, I have factored commonalities out into separate classes. These may or may not form a basis for implementation classes. I am thinking of copying Saxon's tinytree which implements the flyweight design pattern.

Note that this is not user documentation. That is yet to be written.

## Event interface

Need to write an whitespace stripper filter.

## Infoset items

The following infoset items must be creatable from the events:

### Document

- Document information item
- children
- base URI
- unparsed entities (optional)

### Element

- Element information items
- namespace name
- local name
- children
- attributes
- in-scope namespaces
- base URI
- parent
- The nilled property is assumed to be false.

### Attribute

- Attribute information items
- namespace name
- local name
- normalized value
- attribute type
- owner element (as parent property)

### Namespace

- Namespace information items
- prefix
- namespace name
- parent

### Processing Instruction

- Processing Instruction items (optional)
- target
- content
- base URI
- parent

### Comment

- Comment items (optional)
- content
- parent

### Text

- Character information items
- characcter code
- parent
- element content white space (optional)

## Node Tree

In many cases, types are tentative:.

- Other types have just be provisionally named for the moment, and do not actually exist. E.g. XM_EXPANDED_QNAME for the type xs:QName, ANY_ATOMIC and ANY_URI. Further investigation may show that a suitable type already exists.
- Where empty-or-singleton lists are shown as a result type, originally took this literally. But now I'm changing it to use an optionally Void non-list result.

A lot of the above is out of date - most of the information is now in the implementation.

# Miscellaneous Notes (to be moved elsewhere in the near future)

## Compatibility

XPath 2.0 deprecates the namespace axis, and XQuery does not support it at all. Implementations are allowed to drop support for the namespace axis. I have never seen it used, and indeed DocBook does not make use of it, so let us drop it.

Allows id function in basic mode?DTD Validation

Do not support disable output escaping (it's evil).

Basic XSLT processor - otherwise need to process XML Schemas

Support serialization option.

Retain original namespace prefix.