"Borg.jibx.extras.DiscardElementMapper" ^ Typo? Or are you trying to tell us that "resistance is futile... all will be assimilated..."? ;)
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Sosnoski Sent: Friday, March 18, 2005 2:19 PM To: [email protected] Subject: Re: [jibx-users] Optional collection It's a good point that JiBX was designed more for flexibility on the Java side than the XML side. I wasn't really thinking initially that users would want to skip over or ignore portions of an XML document being unmarshalled, but that seems to be coming up a lot. The existing support is a kludge in some ways. This is one area that will be totally revamped for 2.0 (along with the collection handling in general - my original approach was based on my experience with how Castor handles collections, and I think that led me down a path that was way too restrictive). You could simplify your unmarshalling a little by using a variation of the Borg.jibx.extras.DiscardElementMapper for the unmarshalling, one which allowed an element name to be set and skipped multiple occurrences of that particular element - but you would still need to have get/set methods for the result. The JibxSoap extensions sound interesting, and I can see where there are many types of applications that could benefit from caching responses. Let me know where you're finding difficulties in extending the current code and I'll try to work on providing ways to make it more extensible. - Dennis Aaron Smuts wrote: >Thanks but I had to define a dummy load and a dummy >size method to make it work. I'll send my mapping >file over tomorrow. > >Jibx is easy when you are going from object to xml, >but not the other way. > >I'm working on some extensions to Jibx soap. For one, >I want to be able to cache marshalled xml and serve it >rather than having to generate xml from cached >objects. > >Aaron > > > > >--- "Davies, Joshua" <[EMAIL PROTECTED]> >wrote: > > > >>I just recently had to solve a similar problem. >>It's not perfect, since >>you have to add an "add" method to the target object >>(I just call it >>"addIgnored") which ignores the elements, but it >>would look like this: >> >> <struct name="ItemAttrribute" >>class="com.smuts.aws.ItemAttribute"> >> <collection add-method="addIgnored"> >> <value style="element" name="Actor" /> >> </collection> >> <value style="element" field="director" >>name="Director" /> >> >>With an extra method in the ItemAttributes class >>like this: >> >> public void addIgnored( Object o ) >> { >> // Do nothing >> } >> >>(just making the collection usage="optional" doesn't >>work - the jibx >>compiler won't compile a collection element that >>doesn't have some means >>of adding it to the parent object, unfortunately). >> >>I found this difficult to determine from the >>published docs; I added >>some samples up on the Wiki, but if anybody's >>working on revamping the >>documentation ;) I hope he'll see fit to include my >>samples (or similar >>ones) in the "official" tutorial. >> >>-----Original Message----- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On >>Behalf Of Smuts, >>Aaron >>Sent: Wednesday, March 16, 2005 12:28 PM >>To: [email protected] >>Subject: [jibx-users] Optional collection >> >>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=ick >>_______________________________________________ >>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 > > > > > >------------------------------------------------------- >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_id=6595&alloc_id=14396&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_id=6595&alloc_id=14396&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
