-- Representation of XML documents: data XmlExp = XText String | XElem String [(String,String)] [XmlExp] -- Use abbreviations: xtxt :: String -> XmlExp xtxt s = XText s xml :: String -> [XmlExp] -> XmlExp xml tag xes = XElem tag [] xes -- XML documents from the `contacts` example: entry1 :: XmlExp entry1 = xml "entry" [xml "name" [xtxt "Hanus"], xml "first" [xtxt "Michael"], xml "phone" [xtxt "+49-431-8807271"], xml "email" [xtxt "mh@informatik.uni-kiel.de"], xml "email" [xtxt "hanus@email.uni-kiel.de"] ] entry2 :: XmlExp entry2 = xml "entry" [xml "name" [xtxt "Smith"], xml "first" [xtxt "William"], xml "nickname" [xtxt "Bill"], xml "phone" [xtxt "1-987-742-9388"] ]