Design and Implementation of a validating XML parser in Haskell: Master's thesis; University of Applied Sciences Wedel | ||
---|---|---|
Prev | Chapter 4. Package hvalidator | Next |
Transformation of the document is done by the module DocTransformation. The transformation should be started after validating the document.
Tasks:
Adding default values of attributes
Normalizing attribute values
Sorting all attributes in lexicographic order
Before the document can be transformed, a lookup-table is built on the basis of the DTD which maps element names to their transformation functions. The transformation functions are XmlFilter functions, which take a node and return the transformed node. After the initialization phase the whole document is traversed in preorder and every element is transformed by its transformation filter from the lookup-table. The result is a new, transformed XmlTree.