aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xmerl
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2011-05-09 12:14:43 +0200
committerHenrik Nord <[email protected]>2011-05-09 12:14:43 +0200
commitfac6e52aee5853d477f0bf85644c13858be1eb72 (patch)
tree96892ba1b2434bb5b9a415c430a753c4fb58637e /lib/xmerl
parent9f66f078bcd5cb4242e22e60242dab12c57cdc47 (diff)
parenta011451e7e40690b533003802ee54f7c6f77e16e (diff)
downloadotp-fac6e52aee5853d477f0bf85644c13858be1eb72.tar.gz
otp-fac6e52aee5853d477f0bf85644c13858be1eb72.tar.bz2
otp-fac6e52aee5853d477f0bf85644c13858be1eb72.zip
Merge branch 'tm/xmerl_attr_charref_fix' into dev
* tm/xmerl_attr_charref_fix: Prevent xmerl from over-normalizing character references in attributes
Diffstat (limited to 'lib/xmerl')
-rw-r--r--lib/xmerl/src/xmerl_scan.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl
index e07d495fc7..e47e74db6a 100644
--- a/lib/xmerl/src/xmerl_scan.erl
+++ b/lib/xmerl/src/xmerl_scan.erl
@@ -2283,8 +2283,16 @@ scan_att_chars("&" ++ T, S0, Delim, Acc, TmpAcc,AT,IsNorm) -> % Reference
true ->
scan_att_chars(T1,S1,Delim,[ExpRef|Acc],[ExpRef|TmpAcc],AT,IsNorm);
_ ->
- scan_att_chars(string_to_char_set(S#xmerl_scanner.encoding,ExpRef)
- ++ T1, S1, Delim, Acc,TmpAcc, AT,IsNorm)
+ Ch = string_to_char_set(S#xmerl_scanner.encoding, ExpRef),
+ case T of
+ "#" ++ _ ->
+ %% normalization rules (sec 3.3.3) require that for
+ %% character references, the referenced character be
+ %% added directly to the normalized value
+ scan_att_chars(T1, S1, Delim, Ch ++ Acc,TmpAcc, AT,IsNorm);
+ _ ->
+ scan_att_chars(Ch ++ T1, S1, Delim, Acc,TmpAcc, AT,IsNorm)
+ end
end;
scan_att_chars("<" ++ _T, S0, _Delim, _Acc,_, _,_) -> % Tags not allowed here
?fatal(unexpected_char, S0);