Sounds like you want to unmarshall directly into java.lang.String. No sure you can do that because String does not have a setter, but you may be able to do something using an object factory.
object->factory takes 1 argument. http://jibx.sourceforge.net/details/binding-attributes.html#string Take a look at "add-constructors" in order to create something like: <binding> <mapping name="request" class="java.lang.String" add-constructor="id"> <value name="id" field="id"/> </mapping> </binding> http://jibx.sourceforge.net/details/binding-element.html or something like that. Not sure just guessing, but hope that gives you a couple of pointers. On Mon, 10 Nov 2008 J S <[EMAIL PROTECTED]> wrote: > Hi David, > > thanks for your reply. I wasn't very clear on the post (my > appologies) but I don't want to create a "Request" class to wrap the > String. I want the contents of the <id> tag to populate the String > without the wrapper. The reason being that I am using Spring to > implement a service end point that uses jibx as the marshalling > mechanism. > > So my class implementing the Marshaller looks like: > > import org.springframework.oxm.Marshaller; > import > org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint; > > public class JibxGetJobEndpoint extends AbstractMarshallingPayloadEndpoint { > > public JibxGetJobEndpoint( Marshaller marshaller ) { > super( marshaller ); > } > > @Override > protected Object invokeInternal( Object id ) throws Exception { > System.out.println( "Received id: " + id ); > return getResult( id ); > } > } > > > As a result, I would really like jibx to unmarshall the <id> tag > from my example directly into the id parameter (without having to > introduce the Request wrapper you suggest). > > Any ideas are greatly appreciated. > > Thanks, > > Javier. > > --- On Mon, 11/10/08, David Newcomb <[EMAIL PROTECTED]> wrote: > >> From: David Newcomb <[EMAIL PROTECTED]> >> Subject: Re: [jibx-users] Unmarshalling a tag to java.lang.String >> To: [email protected] >> Received: Monday, November 10, 2008, 12:50 PM >> Something like the following should do the trick. >> [untested] >> >> <binding> >> <mapping name="request" >> class="uk.co.bigsoft.Request"> >> <value name="id" field="id"/> >> </mapping> >> </binding> >> >> >> public class Request >> { >> private String id ; >> Request() >> { >> // >> } >> >> public void setId(String id) >> { >> this.id = id; >> } >> >> public String getId() >> { >> return id; >> } >> } >> >> >> Regards, >> David >> >> On Mon, 10 Nov 2008 J S <[EMAIL PROTECTED]> wrote: >> >> > Hello: >> > >> > I would like the following XML snippet: >> > >> > <request> >> > <id>foo</id> >> > </request> >> > >> > to be unmarshalled into an instance of >> java.lang.String, whose value is: foo >> > In other words, I'd like to be able to use >> java.lang.String as the >> > top level class to be used as the target for the >> unmarshalling. >> > >> > If this is possible, can you please suppy a sample >> jibx mapping file >> > to accomplish this? >> > >> > Thanks... >> > >> > >> > >> __________________________________________________________________ >> > Looking for the perfect gift? Give the gift of Flickr! >> > >> > http://www.flickr.com/gift/ >> > >> > >> ------------------------------------------------------------------------- >> > This SF.Net email is sponsored by the Moblin Your Move >> Developer's challenge >> > Build the coolest Linux based applications with Moblin >> SDK & win great prizes >> > Grand prize is a trip for two to an Open Source event >> anywhere in the world >> > >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> > _______________________________________________ >> > jibx-users mailing list >> > [email protected] >> > >> https://lists.sourceforge.net/lists/listinfo/jibx-users >> > >> >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move >> Developer's challenge >> Build the coolest Linux based applications with Moblin SDK >> & win great prizes >> Grand prize is a trip for two to an Open Source event >> anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> jibx-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/jibx-users > > > __________________________________________________________________ > Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark > your favourite sites. Download it now at > http://ca.toolbar.yahoo.com. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > jibx-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jibx-users > Regards, David --------------------------------------- Managing Director +44 (0) 7866 262 398 BigSoft Limited Reading, UK http://www.bigsoft.co.uk/ Registered in Cardiff, Wales 3960621 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ jibx-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
