Bug in xmerl_scan or xmerl_eventp?

Jani Hakala jahakala@REDACTED
Fri Feb 18 12:57:04 CET 2005


Hi,

When I try to parse an xml-file using xmerl_eventp:file_sax
I get an error about badarg in xmerl_scan:scan_prolog (around line 602)
     {Decl,T2, S2}=scan_xml_decl(T, S),
     Encoding=Decl#xmlDecl.encoding

This happens only if there's <?xml version="1.0" encoding="iso_8859-1"?>
at the beginning of my xml file. 

scan_xml_decl seems to call return_xml_decl after "?>".
return_xml_decl calls hook_fun that calls xmerl:export_element, which
returns CBstate in case of #xmlDecl.

hook_fun returns {CBstate,xmerl_scan:user_state({CBs,CBstate},S)} so
in return_xml_decl 
    {Ret, S3} = Hook(Decl, S2),	
    {Ret, T1, S3}.

Ret is now something else than a #xmlDecl, so Decl#xmlDecl.encoding
fails later in scan_prolog. 

I'm using debian packaged erlang 10.b.1a-2. 

ucs.erl:-vsn('0.3').
xmerl_eventp.erl:-vsn('0.19').
xmerl_scan.erl:-vsn('0.20').
xmerl_validate.erl:-vsn('0.1').
xmerl_xlate.erl:-vsn('0.6').
xmerl_xpath.erl:-vsn('0.13').
xmerl_xpath_pred.erl:-vsn('0.6').
xmerl_xpath_scan.erl:-vsn('0.6').
xmerl_xs.erl:-vsn('0.19').

xmerl_eventp.erl:-date('03-09-17').
xmerl_scan.erl:-date('03-09-16').
xmerl_validate.erl:-date('27-11-02').
xmerl_xlate.erl:-date('00-09-22').
xmerl_xpath.erl:-date('01-02-21').
xmerl_xpath_pred.erl:-date('00-09-22').
xmerl_xpath_scan.erl:-date('00-09-21').
xmerl_xs.erl:-date('03-02-03').

Jani Hakala



More information about the erlang-bugs mailing list