Design and Implementation of a validating XML parser in Haskell: Master's thesis; University of Applied Sciences Wedel | ||
---|---|---|
Prev | Chapter 2. Package hdom | Next |
Besides filters and combinators there exist some access functions for processing the attribute list TagAttrl of nodes.
Functions for processing the attribute list
Looks up the value for a certain attribute. If the attribute does not exist, the data type Nothing is returned.
Looks up the value for a certain attribute. If the attribute does not exist, an empty string is returned.
Returns true if there is an attribute with the searched name in the attribute list.
Adds an attribute, the name and value, to the list.
Adds a list of name-value pairs to the attribute list.
Changes the value of a certain attribute.
Deletes an attribute from the list.
Deletes a list of attributes from the attribute list.
The following example shows the use of access functions for adding a new attribute with the name "att2" and the value "val2" to the attribute list of an XTag node. The type of the node is detected by pattern-matching. If the node is of another type, it is simply returned.