@@ 277,8 277,8 @@ elementChildren = elementNodes >=> isElement
elementContent :: Element -> [Content]
elementContent = elementNodes >=> isContent
-elementText :: Element -> Text
-elementText = contentText . elementContent
+elementText :: Element -> [Text]
+elementText = elementContent >=> contentText
nodeChildren :: Node -> [Node]
nodeChildren = isElement >=> elementNodes
@@ 286,8 286,8 @@ nodeChildren = isElement >=> elementNodes
nodeContent :: Node -> [Content]
nodeContent = nodeChildren >=> isContent
-nodeText :: Node -> Text
-nodeText = contentText . nodeContent
+nodeText :: Node -> [Text]
+nodeText = nodeContent >=> contentText
hasAttribute :: Name -> Element -> [Element]
hasAttribute name e = [e | isJust (attributeContent name e)]
@@ 299,12 299,14 @@ attributeContent :: Name -> Element -> Maybe [Content]
attributeContent name e = M.lookup name (elementAttributes e)
attributeText :: Name -> Element -> Maybe Text
-attributeText name e = fmap contentText (attributeContent name e)
+attributeText name e = fmap contentFlat (attributeContent name e)
-contentText :: [Content] -> Text
-contentText = T.concat . map step where
- step (ContentText t) = t
- step (ContentEntity entity) = T.concat [T.pack "&", entity, T.pack ";"]
+contentText :: Content -> [Text]
+contentText (ContentText t) = [t]
+contentText (ContentEntity entity) = [T.pack "&", entity, T.pack ";"]
+
+contentFlat :: [Content] -> Text
+contentFlat cs = T.concat (cs >>= contentText)
typeString :: String -> a -> TypeRep
typeString str _ = mkTyConApp (mkTyCon ("Data.XML.Types." ++ str)) []