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 ...@@ -23,9 +23,9 @@ definition module Text.GenXML
* nodesWithMergedConsecutiveText :: ![XMLNode] -> [XMLNode] * nodesWithMergedConsecutiveText :: ![XMLNode] -> [XMLNode]
* nodesWithMergedConsecutiveText [] = [] * nodesWithMergedConsecutiveText [] = []
* nodesWithMergedConsecutiveText [XMLText text1, XMLText text2: rest] = * nodesWithMergedConsecutiveText [XMLText text1, XMLText text2: rest] =
* nodesWithMergedConsecutiveText [XMLText $ text1 +++ text2: rest] * nodesWithMergedConsecutiveText [XMLText $ text1 +++ text2: rest]
* nodesWithMergedConsecutiveText [node: rest] = * nodesWithMergedConsecutiveText [node: rest] =
* [nodeWithMergedConsecutiveText node: nodesWithMergedConsecutiveText rest] * [nodeWithMergedConsecutiveText node: nodesWithMergedConsecutiveText rest]
*/ */
import StdOverloaded, StdGeneric, Data.Either import StdOverloaded, StdGeneric, Data.Either
......
...@@ -11,12 +11,17 @@ derive ggen XMLNode, XMLAttr ...@@ -11,12 +11,17 @@ derive ggen XMLNode, XMLAttr
// TODO: Generate URIs for namespaces, instead of using names. // TODO: Generate URIs for namespaces, instead of using names.
ggen{|XMLDoc|} st = ggen{|XMLDoc|} st =
[ XMLDoc [ docWithNamedCharacterEntityReference
(unNameString <$> defaultNamespace) : [ XMLDoc
(bifmap unNameString unNameString <$> namespaces) (unNameString <$> defaultNamespace)
(XMLElem rootName rootAttrs rootChildren) (bifmap unNameString unNameString <$> namespaces)
\\ (defaultNamespace, namespaces, rootName, rootAttrs, rootChildren) <- ggen{|*|} st (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] 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