[erlang-questions] Erlsom question, erlsom:scan fails but erlsom:scan_file ok

Willem de Jong w.a.de.jong@REDACTED
Wed Aug 19 20:14:18 CEST 2009


Hi Russel,

Not quite dead, and not entirely perfect. But the bugs that I know of are
small, and somebody posted a patch for the worst bug. The process to create
a new version, run all the tests, package and deploy it to sourceforge takes
me several hours, and I haven't found the time or the courage so far.

Anyway, my impression from the error message below is that you have somehow
passed {ok, Model} to erlsom:scan(), in stead of just Model. Is that
possible? If not, please give me a bit more context so that I can do some
testing.

Regards,
Willem
On Wed, Aug 19, 2009 at 3:27 PM, Russell Brown <russell.brown@REDACTED>wrote:

> Hi,
> I hope it is OK posting this here. I tried looking at the erlsom support
> forum on Sourceforge and the last post was 2008 so I figured it was all but
> dead (or maybe perfect software, who knows?)
>
> I am using erlsom for an EC2 client I am writing. I created an XSD (munged
> from AWS wsdl file) and got erlsom to "compile" it to a model. I then use
> the Model to scan the result of an http call to an EC2 webservice. I get
> this:
>
>
> ** exception throw: {'EXIT',
>                     {error,
>                      [{exception,
>                        {function_clause,
>                         [{erlsom_parse,stateMachine,
>                           [startDocument,
>                            {state,undefined,undefined,
>                             {ok,
>                              {model,
>                               [{type,'_document',sequence,[{...}],[],...},
>
>  {type,'_document-UnmonitorInstancesResponse',
>                                 sequence,
>                                 [...],...},
>                                {type,'_document-MonitorInstancesResponse',
>                                 sequence,...},
>                                {type,'_document-UnmonitorInstances',...},
>                                {type,...},
>                                {...}|...],
>                               [{ns,
>                                 "http://ec2.amazonaws.com/doc/2009-04-04/
> ",
>                                 undefined},
>                                {ns,"http://www.w3.org/2001/
> XMLSchema",[...]}],
>                               "http://ec2.amazonaws.com/doc/2009-04-04/
> ",[]}},
>                             [],undefined,undefined}]},
>                          {erlsom_parse,xml2StructCallback,2},
>                          {erlsom_sax_list,wrapCallback,2},
>                          {erlsom_sax_list,parse,2},
>                          {erlsom,scan2,3},
>                          {erl_eval,do_apply,5},
>                          {shell,exprs,6},
>                          {shell,eval_exprs,6}]}},
>                       {stack,[undefined]},
>                       {received,startDocument}]}}
>     in function  erlsom:scan2/3
>
>
> The parameters to the function being the Model returned from {ok, Model} =
> erlsom:compile_xsd_file("ec2.xsd") and  Body from {ok, {{_Version, 200,
> _ReasonPhrase}, _Headers, Body}} = http:request( Url ),
>
> However if I write the Body to a file with file:write_file("response.xml",
> Body) and then call erlsom:scan_file("response.xml", Model). it works as I
> would expect and as described in the documentation.
>
> what happens to that Body parameter in file:write_file and can I do that to
> the result of the http call before passing it erlsom:scan ?
>
> Many thanks in advance if you can help
>
> Cheers
>
> Russell
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


More information about the erlang-questions mailing list