Skip to content

Commit

Permalink
[xmerl] Fix bug in namespace handling for attributes
Browse files Browse the repository at this point in the history
The uniqueness check of attributes failed when the namespace_conformant
flag was set to true.
  • Loading branch information
lthor committed Dec 13, 2011
1 parent b92ea63 commit 97620b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions lib/xmerl/doc/src/notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
<p>
Own Id: OTP-9753</p>
</item>
<item>
<p>
Fix bug in namespace handling for attributes when the
<c>namespace_conformant</c> flag is set to true. </p>
<p>
Own Id: OTP-9821</p>
</item>
</list>
</section>

Expand Down
11 changes: 7 additions & 4 deletions lib/xmerl/src/xmerl_scan.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2108,21 +2108,24 @@ scan_element(">" ++ T, S0 = #xmerl_scanner{event_fun = Event,
NSI, Namespace, SpaceDefault) ->
?bump_col(1),
Attrs = lists:reverse(Attrs0),
wfc_unique_att_spec(Attrs,S),
XMLSpace = case lists:keysearch('xml:space', #xmlAttribute.name, Attrs) of
E0=processed_whole_element(S,Pos,Name,Attrs,Lang,Parents,NSI,Namespace),

#xmlElement{attributes = Attrs1} = E0,
wfc_unique_att_spec(Attrs1,S),
XMLSpace = case lists:keysearch('xml:space', #xmlAttribute.name, Attrs1) of
false -> SpaceDefault;
{value, #xmlAttribute{value="default"}} -> SpaceOption;
{value, #xmlAttribute{value="preserve"}} -> preserve;
_ -> SpaceDefault
end,

E0=processed_whole_element(S,Pos,Name,Attrs,Lang,Parents,NSI,Namespace),
E0=processed_whole_element(S,Pos,Name,Attrs1,Lang,Parents,NSI,Namespace),
S1 = #xmerl_scanner{} = Event(#xmerl_event{event = started,
line = StartL,
col = StartC,
data = E0}, S),

{Content, T1, S2} = scan_content(T, S1, Name, Attrs, XMLSpace,
{Content, T1, S2} = scan_content(T, S1, Name, Attrs1, XMLSpace,
E0#xmlElement.language,
[{Name, Pos}|Parents], Namespace),

Expand Down

0 comments on commit 97620b3

Please sign in to comment.