[erlang-questions] xmerl question
Brad Anderson
brad@REDACTED
Sun Jul 22 07:00:35 CEST 2007
Hi,
I am not getting a match correct...
For the #xmlElement like:
<matchup kickoff="1189125000" gameSecondsRemaining="3600">
<team id="NOS" isHome="0" score=""/>
<team id="IND" isHome="1" score=""/>
</matchup>
I'm trying to parse it with:
parse_matchup(Matchup) ->
#xmlElement{attributes=Attribs, content=Content} = Matchup,
[ #xmlAttribute{name=kickoff, value=Kickoff} ] = Attribs,
Kickoff.
I'm getting a badmatch [1] when I try to get the value of the 'kickoff'
attribute. Any idea what I'm doing wrong?
I used
Matchups = [parse_matchup(M) || M <- xmerl_xpath:string("//matchup", Xml)],
to send Matchup to the fn, but I didn't want to keep using xpath on each
attrib and child node, because of efficiency. Should I not worry about
that?
Cheers,
BA
[1]
=ERROR REPORT==== 22-Jul-2007::00:56:55 ===
Error in process <0.341.0> with exit value:
{{badmatch,[{xmlAttribute,kickoff,[],[],[],[],1,[],"1189125000",fals\e},{xmlAttribute,gameSecondsRemaining,[],[],[],[],2,[],"3600",false}]},[{schedule,parse_matchup,1},{erl_eval,do_\apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
** exited: {{badmatch,[{xmlAttribute,kickoff,
[],
[],
[],
[],
1,
[],
"1189125000",
false},
{xmlAttribute,gameSecondsRemaining,
[],
[],
[],
[],
2,
[],
"3600",
false}]},
[{schedule,parse_matchup,1},
{erl_eval,do_apply,5},
{shell,exprs,6},
{shell,eval_loop,3}]} **
More information about the erlang-questions
mailing list