aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xmerl/src/xmerl_scan.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2019-03-21 16:46:42 +0100
committerErlang/OTP <[email protected]>2019-03-21 16:46:42 +0100
commit88f47c6301b8fa5a4c55a0a0422aeae67f88f4e5 (patch)
tree9920c3254e0c24ec8ebcc40df4fa3963ea7ae887 /lib/xmerl/src/xmerl_scan.erl
parenta4f71b669ad9ece1a4afa671601c7c72dc89f042 (diff)
parenta4defddf3397a7e1d0e85bb1b04f6c13c7c5a88f (diff)
downloadotp-88f47c6301b8fa5a4c55a0a0422aeae67f88f4e5.tar.gz
otp-88f47c6301b8fa5a4c55a0a0422aeae67f88f4e5.tar.bz2
otp-88f47c6301b8fa5a4c55a0a0422aeae67f88f4e5.zip
Merge branch 'lars/xmerl-scan-attribute-fixes/OTP-15684/OTP-15685/ERL-837/ERL-475' into maint-21
* lars/xmerl-scan-attribute-fixes/OTP-15684/OTP-15685/ERL-837/ERL-475: [xmerl] Normalize attribute correctly when references are used [xmerl] Replace character refs correctly in attributes
Diffstat (limited to 'lib/xmerl/src/xmerl_scan.erl')
-rw-r--r--lib/xmerl/src/xmerl_scan.erl15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl
index e543a5a11e..d76ed5c820 100644
--- a/lib/xmerl/src/xmerl_scan.erl
+++ b/lib/xmerl/src/xmerl_scan.erl
@@ -2410,15 +2410,22 @@ scan_att_chars("&" ++ T, S0, Delim, Acc, TmpAcc,AT,IsNorm) -> % Reference
true ->
scan_att_chars(T1,S1,Delim,[ExpRef|Acc],[ExpRef|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);
+ {T2,S2,IsNorm2} =
+ if
+ ?whitespace(hd(ExpRef)) ->
+ normalize(T1, S1, IsNorm);
+ true ->
+ {T1, S1, IsNorm}
+ end,
+ scan_att_chars(T2, S2, Delim, ExpRef ++ Acc, TmpAcc, AT, IsNorm2);
_ ->
- scan_att_chars(Ch ++ T1, S1, Delim, Acc,TmpAcc, AT,IsNorm)
+ Ch = string_to_char_set(S#xmerl_scanner.encoding, ExpRef),
+ scan_att_chars(Ch ++ T1, S1, Delim, Acc, TmpAcc, AT, IsNorm)
end
end;
scan_att_chars("<" ++ _T, S0, _Delim, _Acc,_, _,_) -> % Tags not allowed here
@@ -3964,7 +3971,7 @@ normalize(T,S,IsNorm) ->
{_,T,S} ->
{T,S,IsNorm};
{_,T1,S1} ->
- {T1,S1,true}
+ normalize(T1,S1,true)
end.