the jibx documentation shows an example binding where a set of xml 'instructions' are skipped
(in the structured mapping section of the tutorial).
a collection or a structure that has no corresponding field on your java class can be mapped
like this:
<structure name="itemAttributes" field="_itemAttributes">
<collection name="actors" />
<value name="AudienceRating" field="rating" />
...
</structure>the lack of a corresponding "field" attribute on the collection will cause jibx to skip that xml.
in your case there is no wrapping "actors" element around each actor child element. so
the binding would have to be slightly different.
<structure name="itemAttributes" field="_itemAttributes">
<collection item-type="Actor" />
<value name="AudienceRating" field="rating" />
...
</structure>/ eitan
On Mar 16, 2005, at 12:27 PM, Smuts, Aaron wrote:
I have an xml file that has more data than I want to map to my objects.
I can skip singly occuring elements with a structure with just a name that is marked optional. However, how can I handle unbounded elements that I don't want to map?
The Aws wsdl has lots of these. http://aws-beta.amazon.com/AWSAlexa/AWSAlexa.wsdl
For example, say I get an item like the one below back and I don't want the actor element in the itemattributes section. I could put three structures in, but then as soon as I get a movie with 4 actors listed, it will break.
<Item> <ASIN>B00008DDXB</ASIN> - <SmallImage> - <URL> http://images.amazon.com/images/P/B00008DDXB.01._SCTHUMBZZZ_.jpg </URL> <Height>60</Height> <Width>34</Width> </SmallImage> - <MediumImage> - <URL> http://images.amazon.com/images/P/B00008DDXB.01._SCMZZZZZZZ_.jpg </URL> <Height>140</Height> <Width>80</Width> </MediumImage> - <LargeImage> - <URL> http://images.amazon.com/images/P/B00008DDXB.01._SCLZZZZZZZ_.jpg </URL> <Height>475</Height> <Width>272</Width> </LargeImage> - <ItemAttributes> <Actor>Daniel Radcliffe</Actor> <Actor>Rupert Grint</Actor> <Actor>Emma Watson (II)</Actor> <AudienceRating>PG (Parental Guidance Suggested)</AudienceRating> <Director>Chris Columbus</Director> <Format>Color</Format> <Format>Closed-captioned</Format> <Format>NTSC</Format> - <Languages> - <Language> <Name>English</Name> <Type>Original Language</Type> </Language> </Languages> - <ListPrice> <Amount>2499</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$24.99</FormattedPrice> </ListPrice> <NumberOfItems>1</NumberOfItems> <ProductGroup>Video</ProductGroup> <ReleaseDate>2004-06-01</ReleaseDate> <Studio>Warner Home Video</Studio> <TheatricalReleaseDate>2002-11-15</TheatricalReleaseDate> <Title>Harry Potter and the Chamber of Secrets</Title> <UPC>085392359134</UPC> </ItemAttributes> </Item>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ jibx-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
