4XPointer API


Usage

4XPointer provides functions that can be called with a URI to extract the relevant subset of the document at the base URI. The URI must conform to the XPointer 1.0 Candidate Recommendation, with the exception that 4XPointer does not yet support points and ranges. Specifically, any XPointer operation involving points and ranges will return an empty location set.

API

Module Ft.XPointer

The 4XPointer module

Module Summary

Global Functions

Global Function Summary
SelectUri Returns the complete DOM node that results from selecting gainst a URI with an XPointer fragment. 
SelectNode Returns the complete DOM node that results from selecting against a DOM document and an XPointer fragment. 

 

Global Function Details

SelectUri

SelectUri(uri, contextNode, reader)

Returns the complete DOM node that results from selecting gainst a URI with an XPointer fragment.

Parameters
uri of type string conforming to the XPointer spec

The URI (including fragment) to be selected

contextNode of type Object with the interface of Ft.Lib.pDomlette.Node

The node to be taken as context. Basically used in the here() and origin() functions. If None, there is no given context and all operations must be absolute. The default is None.

reader of type Object with the interface of xml.dom.ext.reader.Reader

The object used to create a DOM representation from text. Defaults according to the BETA_DOMLETTE environment variable.

Return Value
A DOM node. The precise type (4DOM, pDomlette, cDomlette, DbDom, etc.) depends on the reader passed in.

The node which was selected by the XPointer expression.

Throws
Ft.XPointer.XPtrException

Raised when an invalid URI according to XPointer is provided.

xml.sax.saxlib.SAXException

Raised if there is a low-level SAX error.

xml.sax.saxlib.SAXException

Raised if the XML parser reports a well-formedness or validity error.



SelectNode

SelectNode(doc, fragment, contextNode)

Returns the complete DOM node that results from selecting against a DOM document and an XPointer fragment.

Parameters
doc of type Object with the interface of Ft.Lib.pDomlette.Node

The root DOM document of the XPointer operations.

fragment of type string

The URI fragment representing the desired XPointer.

contextNode of type Object with the interface of Ft.Lib.pDomlette.Node

The node to be taken as context. Basically used in the here() and origin() functions. If None, there is no given context and all operations must be absolute. The default is None.

Return Value
A DOM node. The precise type (4DOM, pDomlette, cDomlette, DbDom, etc.) depends on the reader passed in.

The node which was selected by the XPointer expression.

Throws
Ft.XPointer.XPtrException

Raised when an invalid URI according to XPointer is provided.