My guess is that the default (un)marshaller doesn't support this.
You can do what you want by creating a custom (un)marshaller.
http://jibx.sourceforge.net/tutorial/binding-custom.html
On 11/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Yes. The problem is that I can't change the source xml and I would like
to keep also the same Java. Is there anything that I can change in the
binding.xml? Can I use "a" for root mapping instead of "p"?
Thanks.
On Wed, 22 Nov 2006 22:51:31 -0500, "Stephane Elie"
<[EMAIL PROTECTED]> said:
> Hi Joel,
>
> You have a mismatch between XML vs mapping vs Java, if I assume that the
> Java is OK (because the XML is invalid), here are the appropriate XML
and
> mapping for it:
> This is untested so it may contain mistakes, let me know if this is the
> case.
>
> The source xml:
> <p>
> <c>0</c>
> <d>Success</d>
> </p>
>
> The binding file:
> <binding>
> <mapping class="Response" name="p">
> <value name="c" field="code" />
> <value name="d" field="desc" />
> </mapping>
> </binding>
>
> Stephane
>
> On 11/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
> >
> > Hi All,
> >
> > This is what I have.
> >
> > The source xml:
> > <p>
> > <a>
> > <c>0</code>
> > <d>Success</desc>
> > </a>
> > </p>
> >
> > The binding file:
> > <binding>
> > <mapping class="Response" name="p">
> > <structure name="a">
> > <value name="c" field="code" />
> > <value name="d" field="desc" />
> > </structure>
> > </mapping>
> > </binding>
> >
> > The java class and call code:
> > public class Response {
> > private int code = 10;
> > private String desc = "Internal error";
> > }
> >
> > final IBindingFactory bFact =
> > BindingDirectory.getFactory(responseClass);
> > final IUnmarshallingContext context =
> > bFact.createUnmarshallingContext();
> > response = (IResponse)
> > context.unmarshalDocument(method.getResponseBodyAsStream(), null);
> >
> > The mapping is not working because it tries to create an Response with
> > an InnerClass "a" but it crashes because the Response Object doesn't
> > have any "a" property.
> >
> > Any help/idea? TIA,
> >
> > Joel
> >
> > --
> > --
> >
> > [EMAIL PROTECTED]
> >
> > --
> > http://www.fastmail.fm - Or how I learned to stop worrying and
> > love email again
> >
> >
> >
-------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to
share
> > your
> > opinions on IT & business topics through brief surveys - and earn cash
> >
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > jibx-users mailing list
> > jibx-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jibx-users
> >
--
[EMAIL PROTECTED]
--
http://www.fastmail.fm - I mean, what is it about a decent email service?
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users