Design and Implementation of a validating XML parser in Haskell: Master's thesis; University of Applied Sciences Wedel | ||
---|---|---|
Prev | Next |
This chapter describes the package hvalidator which provides all functions for validating XML documents represented as XmlTree. The validation process basically consists of three phases. First the DTD is validated, after this the document is validated. In the last step the document is transformed: missing default values are added and attribute values are normalized. Unlike other popular XML validation tools the validation functions return a list of errors instead of aborting after the first error was found.
While the modules from package hparser use a monadic approach, these modules are written purely functional. Validation is done by filter functions of type XmlFilter. These filters return a list of errors or an empty list if no errors are detected.
The only public module for validating XML documents is the module Validation. It exports all functions for validating and transforming XML documents. Validation is basically a helper module, which combines the functionalities of the internal modules taking part at validation and transformation.
Internal modules
Provides functions for validating the DTD of XML documents.
Provides functions for validating the elements and attributes of XML documents.
Provides functions for transforming XML documents after they have been validated. The transformation phase is part of the validation process.
Provides functions to normalize attribute values and to check if the attribute value matches the lexical constraints of its type.
Support DocValidation by validating the content model of an element. The algorithm used is based on derivatives of regular expressions.