Skip to content

Generators - Deferred Evaluation in XPath 4

· Balisage Series on Markup Technologies · 0 citations

Abstract

XPath lacks an explicitly-specified portable mechanism for processing large, unbounded, or externally sourced data without full materialization. The paper addresses this limitation by introducing generators as a first-class abstraction for deferred evaluation in XPath 4. Generators are represented as immutable records that encapsulate state and two operations—value access and progression—allowing result-values to be computed incrementally and only when demanded. On top of this abstraction, the paper defines a composable library of functions that enables complex data-processing pipelines without eager evaluation. This model provides: precise control over evaluation, natural support for infinite and streaming data, early termination without special constructs, and integration with external data sources via a precisely-defined provider protocol. The approach is entirely implementation-independent and is expressed using executable XPath definitions. Through examples and a real-world use case of news feed aggregation, the paper demonstrates how generators extend XPath with a practical and expressive model for resource-efficient computation.

View source

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.