Couldn't you also set the "structure a" as usage="optional"?
On 11/22/06, Stephane Elie <[EMAIL PROTECTED]> wrote:
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
>
-------------------------------------------------------------------------
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