Commit 3d409129 authored by Steffen Michels's avatar Steffen Michels

add test with named entity references in text and attribute data

parent 04bff694
Pipeline #41358 passed with stage
in 1 minute and 46 seconds
......@@ -23,9 +23,9 @@ definition module Text.GenXML
* nodesWithMergedConsecutiveText :: ![XMLNode] -> [XMLNode]
* nodesWithMergedConsecutiveText [] = []
* nodesWithMergedConsecutiveText [XMLText text1, XMLText text2: rest] =
* nodesWithMergedConsecutiveText [XMLText $ text1 +++ text2: rest]
* nodesWithMergedConsecutiveText [XMLText $ text1 +++ text2: rest]
* nodesWithMergedConsecutiveText [node: rest] =
* [nodeWithMergedConsecutiveText node: nodesWithMergedConsecutiveText rest]
* [nodeWithMergedConsecutiveText node: nodesWithMergedConsecutiveText rest]
*/
import StdOverloaded, StdGeneric, Data.Either
......
......@@ -11,12 +11,17 @@ derive ggen XMLNode, XMLAttr
// TODO: Generate URIs for namespaces, instead of using names.
ggen{|XMLDoc|} st =
[ XMLDoc
(unNameString <$> defaultNamespace)
(bifmap unNameString unNameString <$> namespaces)
(XMLElem rootName rootAttrs rootChildren)
\\ (defaultNamespace, namespaces, rootName, rootAttrs, rootChildren) <- ggen{|*|} st
[ docWithNamedCharacterEntityReference
: [ XMLDoc
(unNameString <$> defaultNamespace)
(bifmap unNameString unNameString <$> namespaces)
(XMLElem rootName rootAttrs rootChildren)
\\ (defaultNamespace, namespaces, rootName, rootAttrs, rootChildren) <- ggen{|*|} st
]
]
where
docWithNamedCharacterEntityReference =
XMLDoc Nothing [] (XMLElem (uname "someName") [XMLAttr (uname "attr") "< >\" '&"] [XMLText "\"& <>\""])
ggen{|XMLQName|} st = [XMLQName (unNameString <$> namespace) (unNameString name) \\ (namespace, name) <- ggen{|*|} st]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment