Hi,

i want to unmarshall the xml response send by Flickr with Jibx.
Although having read the binding tutorial and studied the examples i 
have trouble mapping
an attribute of a collection element.
The xml format of the Flickr response looks like this:

<rsp stat="ok">
<photos page="1" pages="361" perpage="100" total="36080">
    <photo url="http://xyz.com"; title="flowers" />
    <photo url="http://xyz.com"; title="more flowers"/>
    ...
</photos>
</rsp>

I hav 2 Java classes i want to map this xml to:

FlickrSearchResponse:
 private int numberOfHits;
 private List<FlickrSearchResult> searchResults;
 +getters/setters

FlickSearchResult:
private String title;
private String urt;
+getters/setters

This is my binding file so far:

<binding>
    <mapping name="rsp"
        class="de.neofonie.wefind.model.search.FlickrSearchResponse">
        <collection name="photos" field="searchResults"
            create-type="java.util.ArrayList" />
    </mapping>
   
<mapping name="photo"
        class="de.neofonie.wefind.model.search.FlickrSearchResult">
        <value style="attribute" name="url" field="url" />
        <value style="attribute" name="title" field="title" />
    </mapping>
</binding>

It works and populates the list of FlickrSearchResults within 
FlickrSearchResponse.
But i don't know how i can additionally map the photos attribute "total" 
to the numberOfHitsField
in FlickrSearchResponse. The collection element in the binding file does 
not allow
nested child value elements with attribute style. How can i do it?

Many thanks in advance,
Jan




-- 
--------------------------------
Jan Lisse
F&E

neofonie GmbH
Robert-Koch-Platz 4
10115 Berlin
fon: +49.30 24627 533
fax: +49.30 24627 120

Handelsregister
Berlin-Charlottenburg: HRB 67460

Geschaeftsfuehrung
Helmut Hoffer von Ankershoffen
Nurhan Yildirim
--------------------------------



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to