[erlang-questions] xmerl SAX interface

Willem de Jong w.a.de.jong@REDACTED
Mon Feb 5 19:55:59 CET 2007


I tried to find this out as well, but I didn't find the answer either.
I ended up implementing my own SAX parser. It is part of Erlsom (which
you can find on Sourceforge).

Your example could be parsed as follows.

S = "<e1 xmlns='urn'>
      <e2 a2='b'>2</e2>

C = fun(Event, State) ->
  io:format("~p\n", [Event]),

erlsom:sax(S, [], C).

The result:
{ignorableWhitespace,"\n\n    "}
{ignorableWhitespace,"\n\n    "}
{ignorableWhitespace,"\n\n  "}


On 2/5/07, Ladislav Lenart <lenartlad@REDACTED> wrote:
> Hello,
> I am trying to implement a XML SAX driver using xmerl and I got lost
> on the way a little. xmerl_eventp seems that it is what I am looking
> for (SAX driver), but when I try to parse the following
>   <e1 xmlns='urn'>
>     <e2 a2='b'>2</e2>
>     <e3>3</e3>
>   </e1>
> I get only the "closing" events which is not what I would expect
> (from a SAX driver).
> I have read the examples in xmerl 0.20 and used Google extensively,
> but with no luck so far.
> Can anyone please show me how to set up and SAX-parse a simple XML
> document like the one above (namespaces are not necessary but would
> be great, too).
> Links to xmerl tutorials/faqs/... are also welcome.
> Thanks in advance,
> Ladislav Lenart
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list