From 97620b3aaeeb3a00444bb7770aa0d74afea5bb4e Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Tue, 13 Dec 2011 13:36:25 +0100 Subject: [xmerl] Fix bug in namespace handling for attributes The uniqueness check of attributes failed when the namespace_conformant flag was set to true. --- lib/xmerl/doc/src/notes.xml | 7 +++++++ lib/xmerl/src/xmerl_scan.erl | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/xmerl/doc/src/notes.xml b/lib/xmerl/doc/src/notes.xml index 8fa352d951..8734bd8771 100644 --- a/lib/xmerl/doc/src/notes.xml +++ b/lib/xmerl/doc/src/notes.xml @@ -48,6 +48,13 @@

Own Id: OTP-9753

+ +

+ Fix bug in namespace handling for attributes when the + namespace_conformant flag is set to true.

+

+ Own Id: OTP-9821

+
diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl index ec7ea534d6..48951b6723 100644 --- a/lib/xmerl/src/xmerl_scan.erl +++ b/lib/xmerl/src/xmerl_scan.erl @@ -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), -- cgit v1.2.3