aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xmerl/src/xmerl_scan.erl
diff options
context:
space:
mode:
authorShaun Mangelsdorf <[email protected]>2016-11-30 06:10:28 +1000
committerShaun Mangelsdorf <[email protected]>2016-11-30 06:26:56 +1000
commit90f1bcd23ae888c85ebe9b2b83ed9662a924300f (patch)
tree1423c20f1a4a7c1482f941c48c6497fb408f9d3b /lib/xmerl/src/xmerl_scan.erl
parentf085f89c869c34987ce650c4727eb3575a310e83 (diff)
downloadotp-90f1bcd23ae888c85ebe9b2b83ed9662a924300f.tar.gz
otp-90f1bcd23ae888c85ebe9b2b83ed9662a924300f.tar.bz2
otp-90f1bcd23ae888c85ebe9b2b83ed9662a924300f.zip
Include explicit attrs when default_attrs=true
With the `default_attrs` option set to `true`, xmerl was replacing the attributes for each element with the default attributes, discarding any attributes which were explicitly set. The new behaviour appends the default attributes, keeping the explicit attributes intact.
Diffstat (limited to 'lib/xmerl/src/xmerl_scan.erl')
-rw-r--r--lib/xmerl/src/xmerl_scan.erl22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl
index 5e0459ec21..9f6b27113e 100644
--- a/lib/xmerl/src/xmerl_scan.erl
+++ b/lib/xmerl/src/xmerl_scan.erl
@@ -2225,16 +2225,18 @@ processed_whole_element(S=#xmerl_scanner{hook_fun = _Hook,
AllAttrs =
case S#xmerl_scanner.default_attrs of
true ->
- [ #xmlAttribute{name = AttName,
- parents = [{Name, Pos} | Parents],
- language = Lang,
- nsinfo = NSI,
- namespace = Namespace,
- value = AttValue,
- normalized = true} ||
- {AttName, AttValue} <- get_default_attrs(S, Name),
- AttValue =/= no_value,
- not lists:keymember(AttName, #xmlAttribute.name, Attrs) ];
+ DefaultAttrs =
+ [ #xmlAttribute{name = AttName,
+ parents = [{Name, Pos} | Parents],
+ language = Lang,
+ nsinfo = NSI,
+ namespace = Namespace,
+ value = AttValue,
+ normalized = true} ||
+ {AttName, AttValue} <- get_default_attrs(S, Name),
+ AttValue =/= no_value,
+ not lists:keymember(AttName, #xmlAttribute.name, Attrs) ],
+ lists:append(Attrs, DefaultAttrs);
false ->
Attrs
end,