Bugs in xmerl_sax_parser?

Tony Garnock-Jones tonyg@REDACTED
Wed Sep 23 18:09:48 CEST 2009

Hi all,

I've just been playing with xmerl_sax_parser and I think I've found two

 1. xmerl_sax_parser:file/2 and :stream/2 behave differently. Create a
    file, "t.xml", containing

<elem attr='123' x:attr='234' xmlns='http://lshift.net/d'
xmlns:x='http://lshift.net/x' />

    and then run the two expressions

    xmerl_sax_parser:file("t.xml", [{event_fun, fun (E,_,_) ->
io:format("~p~n", [E]), ok end}]).
    xmerl_sax_parser:stream("<elem attr='123' x:attr='234'
xmlns='http://lshift.net/d' xmlns:x='http://lshift.net/x' />",
[{event_fun, fun (E,_,_) -> io:format("~p~n", [E]), ok end}]).

    Note that they print the same event sequences, but the first results
    in {ok,ok,<<>>}, while the second results in {fatal_error,...}!

 2. The namespace URI supplied on unprefixed attributes in startElement
    tuples is the same as the URI for the default namespace. According
    to http://www.w3.org/TR/xml-names/#defaulting, "The namespace name
    for an unprefixed attribute name always has no value."

    For example, running one of the expressions above causes the
    following to be printed:


    While applications can work around this by ignoring the attribute's
    namespace name in cases where the prefix == "", I wonder if it
    wouldn't be better to supply "" for the namespace name for
    unprefixed attributes, like this:


 [][][] Tony Garnock-Jones     | Mob: +44 (0)7905 974 211
   [][] LShift Ltd             | Tel: +44 (0)20 7729 7060
 []  [] http://www.lshift.net/ | Email: tonyg@REDACTED

More information about the erlang-questions mailing list