From b1c6356a9d3cd8d6e9767a4252eb0bcc1602664b Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Tue, 19 Mar 2019 07:55:37 +0100 Subject: [xmerl] Replace character refs correctly in attributes --- lib/xmerl/src/xmerl_scan.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl index e543a5a11e..0b7f378c77 100644 --- a/lib/xmerl/src/xmerl_scan.erl +++ b/lib/xmerl/src/xmerl_scan.erl @@ -2410,14 +2410,14 @@ 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); + scan_att_chars(T1, S1, Delim, ExpRef ++ 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; -- cgit v1.2.3 From a4defddf3397a7e1d0e85bb1b04f6c13c7c5a88f Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Wed, 20 Mar 2019 12:13:49 +0100 Subject: [xmerl] Normalize attribute correctly when references are used --- lib/xmerl/src/xmerl_scan.erl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl index 0b7f378c77..d76ed5c820 100644 --- a/lib/xmerl/src/xmerl_scan.erl +++ b/lib/xmerl/src/xmerl_scan.erl @@ -2415,10 +2415,17 @@ scan_att_chars("&" ++ T, S0, Delim, Acc, TmpAcc,AT,IsNorm) -> % Reference %% 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, ExpRef ++ 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); _ -> Ch = string_to_char_set(S#xmerl_scanner.encoding, ExpRef), - scan_att_chars(Ch ++ T1, S1, Delim, 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 @@ -3964,7 +3971,7 @@ normalize(T,S,IsNorm) -> {_,T,S} -> {T,S,IsNorm}; {_,T1,S1} -> - {T1,S1,true} + normalize(T1,S1,true) end. -- cgit v1.2.3