[erlang-questions] xmerl expanded names
Ulf Wiger
ulf@REDACTED
Fri Feb 3 18:20:25 CET 2012
Refreshing my memory of the xmerl_scan code, I came across this apparent discrepancy:
-record(xmlElement,{
name, % atom()
expanded_name = [], % string() | {URI,Local} | {"xmlns",Local}
So the types are just comments, leaving Dialyzer out of this, but, in xmerl_scan.erl:
processed_whole_element(S=#xmerl_scanner{...},
Pos, Name, Attrs, Lang, Parents, NSI, Namespace) ->
...,
{ExpName, ExpAttrs} =
case S#xmerl_scanner.namespace_conformant of
true ->
…
{expanded_name(Name, NSI, Namespace, S), ExpAttrsX};
false ->
{Name, AllAttrs}
end,
#xmlElement{name = Name,
...,
expanded_name = ExpName,
...}.
If S#xmerl_scanner.namespace_conformant == false, ExpName = Name, but Name cannot be an atom() and a string() at the same time.
The type comments in xmerl.hrl, then, are likely incorrect. Or is it the code? Less likely, I think.
The bug is of course that Dialyzer cannot parse xmerl comments. :)
BR,
Ulf W
More information about the erlang-questions
mailing list