--- otp_src_R13B02/lib/xmerl/src/xmerl_sax_parser_base.erlsrc 2009-09-28 11:42:30.000000000 +0200 +++ otp_src_R13B02_patched/lib/xmerl/src/xmerl_sax_parser_base.erlsrc 2009-09-28 11:42:18.000000000 +0200 @@ -750,7 +750,12 @@ false -> parse_attributes(Rest3, State3, {Tag, [{AttrName, AttValue}|AttList], NsList}); _ -> - ?fatal_error(State, "Attribute exist mor than once in tag: " ++ Tag) + ElName = + case Tag of + {"", N} -> N; + {Ns, N} -> Ns ++ ":" ++ N + end, + ?fatal_error(State, "Attribute exist more than once in element: " ++ ElName) end end; false -> @@ -801,6 +806,8 @@ %%---------------------------------------------------------------------- fix_attributes_ns([], _, Acc) -> Acc; +fix_attributes_ns([{{"", Name}, AttrValue} | Attrs], Ns, Acc) -> + fix_attributes_ns(Attrs, Ns, [{"", "", Name, AttrValue} |Acc]); fix_attributes_ns([{{Prefix, Name}, AttrValue} | Attrs], Ns, Acc) -> Uri = case lists:keysearch(Prefix, 1, Ns) of @@ -1013,13 +1020,13 @@ case catch cf(?STRING_EMPTY, State, Acc, IgnorableWS, fun parse_content/4) of {Rest, State1} when is_record(State1, xmerl_sax_parser_state) -> {Rest, State1}; - {fatal_error, {State1, "No more bytes"}} -> - case State1#xmerl_sax_parser_state.end_tags of - [] -> + {fatal_error, {State1, Msg}} -> + case check_if_document_complete(State1, Msg) of + true -> State2 = send_character_event(length(Acc), IgnorableWS, lists:reverse(Acc), State1), {?STRING_EMPTY, State2}; - _ -> - ?fatal_error(State1, "No more bytes") + false -> + ?fatal_error(State1, Msg) end; Other -> throw(Other) @@ -1105,7 +1112,23 @@ unicode_incomplete_check([Bytes, State, Acc, IgnorableWS, fun parse_content/4], undefined). - + +%%---------------------------------------------------------------------- +%% Function: check_if_document_complete(State, ErrorMsg) -> Result +%% Parameters: State = #xmerl_sax_parser_state{} +%% ErrorMsg = string() +%% Result : boolean() +%% Description: Checks that the document is complete if we don't have more data.. +%%---------------------------------------------------------------------- +check_if_document_complete(#xmerl_sax_parser_state{end_tags = []}, + "No more bytes") -> + true; +check_if_document_complete(#xmerl_sax_parser_state{end_tags = []}, + "Continuation function undefined") -> + true; +check_if_document_complete(_, _) -> + false. + %%---------------------------------------------------------------------- %% Function: send_character_event(Length, IgnorableWS, String, State) -> Result %% Parameters: Length = integer() @@ -3171,7 +3194,7 @@ %% input stream and calls the fun in NextCall. %%---------------------------------------------------------------------- cf(_Rest, #xmerl_sax_parser_state{continuation_fun = undefined} = State, _) -> - ?fatal_error(State, "Continuation function undefined, and more data needed"); + ?fatal_error(State, "Continuation function undefined"); cf(Rest, #xmerl_sax_parser_state{continuation_fun = CFun, continuation_state = CState} = State, NextCall) -> Result = @@ -3202,7 +3225,7 @@ %% input stream and calls the fun in NextCall with P as last parameter. %%---------------------------------------------------------------------- cf(_Rest, #xmerl_sax_parser_state{continuation_fun = undefined} = State, _P, _) -> - ?fatal_error(State, "Continuation function undefined, and more data needed"); + ?fatal_error(State, "Continuation function undefined"); cf(Rest, #xmerl_sax_parser_state{continuation_fun = CFun, continuation_state = CState} = State, P, NextCall) -> Result = @@ -3237,7 +3260,7 @@ %% P2 as last parameters. %%---------------------------------------------------------------------- cf(_Rest, #xmerl_sax_parser_state{continuation_fun = undefined} = State, _P1, _P2, _) -> - ?fatal_error(State, "Continuation function undefined, and more data needed"); + ?fatal_error(State, "Continuation function undefined"); cf(Rest, #xmerl_sax_parser_state{continuation_fun = CFun, continuation_state = CState} = State, P1, P2, NextCall) -> Result =