tree-features: 94c42311abf83075c0377dd565c3f59413965a7b

     1: module XmlHelper where
     2: 
     3: import Data.Char
     4: import Data.Maybe
     5: import Text.XML.Light.Input
     6: import Text.XML.Light.Types
     7: 
     8: name :: Element -> String
     9: name = map toLower . qName . elName
    10: 
    11: countLeaves :: Element -> Int
    12: countLeaves = undefined
    13: 
    14: getAttrs :: Element -> [String]
    15: getAttrs = concatMap (attrFilter . attrStrs) . elAttribs
    16: 
    17: attrStrs :: Attr -> (String, String)
    18: attrStrs a = (qName (attrKey a), attrVal a)
    19: 
    20: attrFilter :: (String, String) -> [String]
    21: attrFilter ("id", _) = []
    22: attrFilter (x,    y) = [x ++ y]
    23: 
    24: parseXml = fromJust . parseXMLDoc
    25: 
    26: getXml = fmap parseXml getContents

Generated by git2html.