Commit 04bff694 authored by Steffen Michels's avatar Steffen Michels

named entity references for quotes in string representations of attribute values

parent ac8d425f
......@@ -58,9 +58,11 @@ where
where
escapedSize` s n i
| i == n = 0
| s.[i] == '<' = 4 + escapedSize` s n (i + 1)
| s.[i] == '>' = 4 + escapedSize` s n (i + 1)
| s.[i] == '&' = 5 + escapedSize` s n (i + 1)
| s.[i] == '<' = 4 + escapedSize` s n (i + 1)
| s.[i] == '>' = 4 + escapedSize` s n (i + 1)
| s.[i] == '&' = 5 + escapedSize` s n (i + 1)
| s.[i] == '\'' = 6 + escapedSize` s n (i + 1)
| s.[i] == '"' = 6 + escapedSize` s n (i + 1)
| otherwise = 1 + escapedSize` s n (i + 1)
serializeDoc :: !XMLDoc !*{#Char} !Int -> (!*{#Char}, !Int)
......@@ -138,8 +140,25 @@ where
# dest = {dest & [dest_i] = '&', [dest_i + 1] = 'g', [dest_i + 2] = 't', [dest_i + 3] = ';'}
= copyChars src (src_i + 1) escape dest (dest_i + 4)
| escape && (src.[src_i] == '&')
# dest = {dest & [dest_i] = '&', [dest_i + 1] = 'a', [dest_i + 2] = 'm', [dest_i + 3] = 'p', [dest_i + 4] = ';'}
# dest =
{ dest
& [dest_i] = '&', [dest_i + 1] = 'a', [dest_i + 2] = 'm', [dest_i + 3] = 'p', [dest_i + 4] = ';'
}
= copyChars src (src_i + 1) escape dest (dest_i + 5)
| escape && (src.[src_i] == '"')
# dest =
{ dest
& [dest_i] = '&', [dest_i + 1] = 'q', [dest_i + 2] = 'u', [dest_i + 3] = 'o'
, [dest_i + 4] = 't', [dest_i + 5] = ';'
}
= copyChars src (src_i + 1) escape dest (dest_i + 6)
| escape && (src.[src_i] == '\'')
# dest =
{ dest
& [dest_i] = '&', [dest_i + 1] = 'a', [dest_i + 2] = 'p', [dest_i + 3] = 'o'
, [dest_i + 4] = 's', [dest_i + 5] = ';'
}
= copyChars src (src_i + 1) escape dest (dest_i + 6)
| otherwise
# dest = {dest & [dest_i] = src.[src_i]}
= copyChars src (src_i + 1) escape dest (dest_i + 1)
......
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