From d515cfd89d02029fea0dbdb43245bb9b94ce4b19 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 17 May 2024 11:46:37 +0200 Subject: [PATCH] Data.XML must escape the data as well --- src/compiler/api/GF/Data/XML.hs | 5 ++--- src/compiler/api/GF/Speech/VoiceXML.hs | 7 ------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/compiler/api/GF/Data/XML.hs b/src/compiler/api/GF/Data/XML.hs index 4d4a3e8ca1..933dc243ad 100644 --- a/src/compiler/api/GF/Data/XML.hs +++ b/src/compiler/api/GF/Data/XML.hs @@ -8,7 +8,7 @@ module GF.Data.XML (XML(..), Attr, comments, showXMLDoc, showsXMLDoc, showsXML, import GF.Data.Utilities -data XML = Data String | CData String | Tag String [Attr] [XML] | ETag String [Attr] | Comment String | Empty +data XML = Data String | Tag String [Attr] [XML] | ETag String [Attr] | Comment String | Empty deriving (Ord,Eq,Show) type Attr = (String,String) @@ -26,8 +26,7 @@ showsXMLDoc xml = showString header . showsXML xml showsXML :: XML -> ShowS showsXML = showsX 0 where showsX i x = ind i . case x of - (Data s) -> showString s - (CData s) -> showString "" + (Data s) -> showString (escape s) (ETag t as) -> showChar '<' . showString t . showsAttrs as . showString "/>" (Tag t as cs) -> showChar '<' . showString t . showsAttrs as . showChar '>' . diff --git a/src/compiler/api/GF/Speech/VoiceXML.hs b/src/compiler/api/GF/Speech/VoiceXML.hs index e627693f1a..0d4ad0d47a 100644 --- a/src/compiler/api/GF/Speech/VoiceXML.hs +++ b/src/compiler/api/GF/Speech/VoiceXML.hs @@ -178,13 +178,6 @@ param name expr = ETag "param" [("name",name),("expr",expr)] var :: String -> Maybe String -> XML var name expr = ETag "var" ([("name",name)]++e) where e = maybe [] ((:[]) . (,) "expr") expr -{- -script :: String -> XML -script s = Tag "script" [] [CData s] - -scriptURI :: String -> XML -scriptURI uri = Tag "script" [("uri", uri)] [] --} -- -- * ECMAScript stuff --