Generic validation in an XPath-Haskell data binding
Michelle Guerra, Johan T. Jeuring, S. Doaitse Swierstra · Utrecht University Repository (Utrecht University) · 2004
An XPath data binding for a given host language provides a translation of XPath expressions to expressions in the host language. This paper discusses an XPathHaskell data binding. XPath validation ensures that a path addresses a possibly nonempty set of nodes in XML documents described by an XML Schema. We present a generic function (defined by induction on the type structure) that validates XPath expressions with respect to an XML Schema. We use Generic Haskell, an extension of Haskell that supports the construction of generic programs. Furthermore we present generic programs that use a valid XPath expression to query and update documents in a typed way. For some XPath expressions, the information present in a given schema is used to avoid visiting parts of a document whose type ensures that no matches or updates will occur.