aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xmerl
diff options
context:
space:
mode:
authorLars Thorsén <[email protected]>2017-04-27 14:09:58 +0200
committerGitHub <[email protected]>2017-04-27 14:09:58 +0200
commit74149d797864cb2de1b4d2b58292d27a4f7895ae (patch)
tree6e5d63e39b810dc18ed4c191379f2a80a5469a63 /lib/xmerl
parent50c902fbdeb0da8daa074b572dd17106e78e3ef9 (diff)
parent027c94a04a3c78daa351b025c68694f01c566560 (diff)
downloadotp-74149d797864cb2de1b4d2b58292d27a4f7895ae.tar.gz
otp-74149d797864cb2de1b4d2b58292d27a4f7895ae.tar.bz2
otp-74149d797864cb2de1b4d2b58292d27a4f7895ae.zip
Merge pull request #1369 from JYZR/fix-xmerl_scan-acc
Improves accumulator fun in xmerl_scan so that only one #xmlText record is returned for strings which have character references. OTP-14377 Improves accumulator fun in xmerl_scan
Diffstat (limited to 'lib/xmerl')
-rw-r--r--lib/xmerl/src/xmerl_scan.erl4
-rw-r--r--lib/xmerl/test/xmerl_SUITE.erl9
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl
index 95dc82e5c9..18fe7031b9 100644
--- a/lib/xmerl/src/xmerl_scan.erl
+++ b/lib/xmerl/src/xmerl_scan.erl
@@ -474,8 +474,8 @@ event(_X, S) ->
%% into multiple objects (in which case {Acc',Pos',S'} should be returned.)
%% If {Acc',S'} is returned, Pos will be incremented by 1 by default.
%% Below is an example of an acceptable operation
-acc(X = #xmlText{value = Text}, Acc, S) ->
- {[X#xmlText{value = Text}|Acc], S};
+acc(#xmlText{value = Text}, [X = #xmlText{value = AccText}], S) ->
+ {[X#xmlText{value = AccText ++ Text}], S};
acc(X, Acc, S) ->
{[X|Acc], S}.
diff --git a/lib/xmerl/test/xmerl_SUITE.erl b/lib/xmerl/test/xmerl_SUITE.erl
index 58c462483c..2e383f95c5 100644
--- a/lib/xmerl/test/xmerl_SUITE.erl
+++ b/lib/xmerl/test/xmerl_SUITE.erl
@@ -55,7 +55,7 @@ groups() ->
{misc, [],
[latin1_alias, syntax_bug1, syntax_bug2, syntax_bug3,
pe_ref1, copyright, testXSEIF, export_simple1, export,
- default_attrs_bug, xml_ns]},
+ default_attrs_bug, xml_ns, scan_splits_string_bug]},
{eventp_tests, [], [sax_parse_and_export]},
{ticket_tests, [],
[ticket_5998, ticket_7211, ticket_7214, ticket_7430,
@@ -268,6 +268,10 @@ xml_ns(Config) ->
} = xmerl_scan:string(Doc2, [{namespace_conformant, true}]),
ok.
+scan_splits_string_bug(_Config) ->
+ {#xmlElement{ content = [#xmlText{ value = "Jimmy Zöger" }] }, []}
+ = xmerl_scan:string("<name>Jimmy Z&#246;ger</name>").
+
pe_ref1(Config) ->
file:set_cwd(datadir(Config)),
{#xmlElement{},[]} = xmerl_scan:file(datadir_join(Config,[misc,"PE_ref1.xml"]),[{validation,true}]).
@@ -533,8 +537,7 @@ ticket_7430(Config) ->
{xmlElement,a,a,[],
{xmlNamespace,[],[]},
[],1,[],
- [{xmlText,[{a,1}],1,[],"é",text},
- {xmlText,[{a,1}],2,[],"\né",text}],
+ [{xmlText,[{a,1}],1,[],"é\né",text}],
[],_,undeclared} ->
ok;
_ ->