[ANNOUNCE] text-xml-qq - XML quasiquoter for Text.XML.Light

Hi, I've just released the first version of text-xml-qq, It's a Template Haskell quasiquoter that converts XML code into Text.XML.Light.Element compile time. Feature requests, bug fixes etc are welcomed. The package only got one backend (xml-package) at the moment but it should be trivial to add more backends (e.g. for a bytestring-based xml package). You can embed Haskell variables in the xml code. Inside xml-elements you use the syntax {foo} for embedded variables. If you wish to embed an element or text you use the syntax <<foo>>. See example or the test-file http://github.com/finnsson/text-xml-qq/blob/master/src/Text/XML/TestQQ.hs at the project site http://github.com/finnsson/text-xml-qq. -- Oscar === Example === Given the variables url = "google.se" elem = "gmail" attrNs = "something" attrName = "Pelle" attrValue = "Arne" elemCont = CRef "testing" cont1 = Elem $ blank_element { elName = QName "hej" Nothing Nothing } cont2 = CRef "other test" the code [$xmlQQ| <{url}:{elem} {attrNs}:{attrName}={attrValue} attr="cool"> <elem ns1:elem1="1" ns2:elem2="2"><<elemCont>></elem> <elem /> <el /> <<cont1>> <<cont2>> {url}:{elem}> |] will generate the data structure element { elName = QName elem Nothing (Just url), elAttribs = [Attr (QName attrName Nothing (Just attrNs)) attrValue, Attr (qname "attr") "cool"], elContent = [ (Elem $ blank_element { elName = QName "elem" Nothing Nothing, elAttribs = [Attr (QName "elem1" Nothing (Just "ns1")) "1", Attr (QName "elem2" Nothing (Just "ns2")) "2"], elContent = [elemCont] }), (Elem $ blank_element { elName =QName "elem" Nothing Nothing}), (Elem $ blank_element { elName = QName "el" Nothing Nothing}), cont1, cont2] } === End example ===
participants (1)
-
Oscar Finnsson