The easiest way of doing this is by defining a custom 
marshaller/unmarshaller for the Message class, with normal <mapping> 
definitions for the Header and Body classes. Your custom unmarshaller 
can unmarshal the Header and then check the resulting values to see if 
the Body needs to be unmarshalled. If not, it can just skip the Body by 
using the UnmarshallingContext.skipElement() method. See the binding 
tutorial 
http://jibx.sourceforge.net/tutorial/binding-custom.html#marunmar 
section for some pointers on doing this type of coding.

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



[EMAIL PROTECTED] wrote:
> Hi everyone. First of all, excuse my english...
> I have an xml structure lile this
> <Something>
>    <header>
>         ...
>         ...
>    </header>
>    <body>
>        ...
>        ...
>    </body>
> </Something>
> I have a Message class with a Header and Body structures inside.
> I have to unmarshall always the header tag, and depending on the value
> of one of the childs of that tag, unmarshall the body tag. For that, I
> have especified a post-set method in my Header class so that checks if
> the value is correct, if not I throw a JibxException to stop the
> unmarshall, but this causes the instance of the message unmarshalled
> being null.
> Is there a way to stop the unmarshalling, not with an exception?.
>
>
>   

-------------------------------------------------------------------------
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

Reply via email to