X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=hxt-compile.git;a=blobdiff_plain;f=Text%2FXML%2FHXT%2FCompilation%2FXmlTree.hs;fp=Text%2FXML%2FHXT%2FCompilation%2FXmlTree.hs;h=1538329147e6dc41dae613fd79a0e667aee25e04;hp=7f8d48bebe390c4e0ba45b214b0d1443b9144710;hb=3128cde83c431e117badabba87cbcd9c7de26b52;hpb=13dc5a370f4d7d3223937346fc63ce94c8aa85a8 diff --git a/Text/XML/HXT/Compilation/XmlTree.hs b/Text/XML/HXT/Compilation/XmlTree.hs index 7f8d48b..1538329 100644 --- a/Text/XML/HXT/Compilation/XmlTree.hs +++ b/Text/XML/HXT/Compilation/XmlTree.hs @@ -32,23 +32,37 @@ compileXNode (XCharRef n) = xn "mkCharRef" $: litInt n compileXNode (XEntityRef s) = xn "mkEntityRef" $: litStr s compileXNode (XCmt s) = xn "mkCmt" $: litStr s compileXNode (XCdata s) = xn "mkCdata" $: litStr s -compileXNode (XPi qn ts) = xn "mkPi" $: HsParen (compileQName qn) $: compileXmlTrees ts -compileXNode (XTag qn ts) = xn "mkElementNode" $: HsParen (compileQName qn) $: compileXmlTrees ts -compileXNode (XDTD de as) = xn "mkDTDNode" $: HsParen (compileDTDElem de) $: HsParen (compileAttributes as) -compileXNode (XAttr qn) = xn "mkAttrNode" $: HsParen (compileQName qn) +compileXNode (XPi qn ts) = xn "mkPi" $: HsParen (compileQName qn) $: compileXmlTrees ts +compileXNode (XTag qn ts) = xn "mkElementNode" $: HsParen (compileQName qn) $: compileXmlTrees ts +compileXNode (XDTD de as) = xn "mkDTDNode" $: compileDTDElem de $: compileAttributes as +compileXNode (XAttr qn) = xn "mkAttrNode" $: HsParen (compileQName qn) compileXNode (XError n s) = xn "mkError" $: litInt n $: litStr s compileDTDElem :: DTDElem -> HsExp -compileDTDElem = error "compileDTDElem: FIXME: not implemented" +compileDTDElem DOCTYPE = unq "DOCTYPE" +compileDTDElem ELEMENT = unq "ELEMENT" +compileDTDElem CONTENT = unq "CONTENT" +compileDTDElem ATTLIST = unq "ATTLIST" +compileDTDElem ENTITY = unq "ENTITY" +compileDTDElem PENTITY = unq "PENTITY" +compileDTDElem NOTATION = unq "NOTATION" +compileDTDElem CONDSECT = unq "CONDSECT" +compileDTDElem NAME = unq "NAME" +compileDTDElem PEREF = unq "PEREF" compileAttributes :: Attributes -> HsExp -compileAttributes = error "compileAttributes: FIXME: not implemented" +compileAttributes = HsList . map compileAttr + where + compileAttr :: (String, String) -> HsExp + compileAttr (k, v) = HsTuple [ litStr k, litStr v ] + xn :: String -> HsExp -xn = HsVar . Qual (Module "XN") . HsIdent +--xn = HsVar . Qual (Module "XN") . HsIdent +xn = unq unq :: String -> HsExp unq = HsVar . UnQual . HsIdent