xmerl_sax_parser node information trivial problem

Jakub Zawierucha Jakub.Zawierucha@REDACTED
Wed Dec 2 11:26:03 CET 2009


Hello,

I'm trying to write a simple app that will process XML file and give me 
information about some nodes. I need to know how many attributes and 
children nodes are avaliable in that node. I know how to obtain attr 
count (just count Attributes) but how about children nodes ? Any ideas ?

i have:

do_magic(Lang, Xml) ->
    xmerl_sax_parser:stream(Xml, [
                                  {continuation_fun, fun continuationfun/1},
                                  {event_fun, fun eventfun/3},
                                  {event_state, {[Lang],<<>>}}
                                 ]).
(...)

eventfun({startElement, Uri, LocalName, QualifiedName, Attrubutes}, 
Location, {Stack, Acc}) ->
    [Lang|_] = Stack,      
            % >>>>>> How many subnodes is in tag called: LocalName <<<<<<
            {Stack, Acc}
    end;

Thanks,
Jakub Zawierucha



More information about the erlang-questions mailing list