Doing the modifications the way you've illustrated below (with a round trip through XML) is going to be really ugly, though. Can't you modify the existing object in-place to have the changes you want? If you really need to change things around perhaps you're better off using a custom marshaller/unmarshaller to just handle the initial creation of the ItineraryRendition.
You can also use a post-set method for the ItineraryRendition to handle the changes. Right now that method has to be a member method of the ItineraryRendition class; in the future JiBX may allow a static method that takes the actual class instance as an argument, so that it doesn't have to be a member method (and you don't need to modify the target class). Would that work for your needs?
- Dennis
Fran�ois Eric wrote:
Hello,
I'm having trouble unmarshalling one of my xml files. The bindings are correct and all but the problem is that the"POJO" being created by the unmarshalling needs to be altered before the unmarshalling is done. Therefore I would need to pass an existing instance of my class and have jibx's unmarshaller populate it:
ItineraryRendition itinerary = new ItineraryRendition();
... (make modifications to itinerary)
output = (ItineraryRendition) unmarshallingContext.unmarshalDocument(itinerary, new StringReader(stringWriter.toString()));
In the previous example, the stringWriter contains the XML document. As you can see, I have passed the itinerary to the unmarshalling document (which is not an existing method).
Is there a way, I can mime such a behaviour? To give an existing instance to jibx instead of having jibx use the default constructor of the object?
Thank you,
Fran�ois
------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users
