aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJimmy Zöger <[email protected]>2017-03-08 14:56:06 +0100
committerJimmy Zöger <[email protected]>2017-03-08 14:56:06 +0100
commit027c94a04a3c78daa351b025c68694f01c566560 (patch)
tree8c8cbb7a25fc1f059e74d42a1fee5cdc797a3ac9 /lib
parentca34a6c16a146cb5780a9c28cb5614e2e846d318 (diff)
downloadotp-027c94a04a3c78daa351b025c68694f01c566560.tar.gz
otp-027c94a04a3c78daa351b025c68694f01c566560.tar.bz2
otp-027c94a04a3c78daa351b025c68694f01c566560.zip
Improves accumulator fun in xmerl_scan so that only one #xmlText record is returned for strings which have character references
* Adds test with character reference in numeric form * Updates test for ticket_7430
Diffstat (limited to 'lib')
-rw-r--r--lib/xmerl/src/xmerl_scan.erl2
-rw-r--r--lib/xmerl/test/xmerl_SUITE.erl9
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl
index 4eacb9fc4d..18fe7031b9 100644
--- a/lib/xmerl/src/xmerl_scan.erl
+++ b/lib/xmerl/src/xmerl_scan.erl
@@ -474,6 +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(#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;
_ ->