[erlang-questions] xmerl with multiple items

Joe Williams joe@REDACTED
Mon Sep 22 16:34:48 CEST 2008


Works great, thanks for the help.

-joe

Steve Vinoski wrote:
> On 9/22/08, Joe Williams <joe@REDACTED> wrote:
>   
>>  I am working on one of the xmerl examples found at
>>  http://blog.tornkvist.org/blog.yaws?id=1193209275268448 specifically,
>>     
>
> <snip/>
>
>   
>>  What is the best way to fix this issue so I can have the code work for
>>  one to many items?
>>     
>
> Change the Val macro to:
>
> -define(Val(X),
>    (fun() ->
>             [{N,V} || #xmlElement{name = N, content = [#xmlText{value
> = V}|_]} <- X]
>     end)()).
>
> When xpath matches multiple items, this allows all matches to appear
> in the result, and it still works for one match as well.
>
> --steve
>   

-- 
Name: Joseph A. Williams
Email: joe@REDACTED




More information about the erlang-questions mailing list