Hi Laurent,

You can use serializer and deserializer methods that take the 
marshalling or unmarshalling context (respectively) as an extra 
parameter (so a signature like "public static XXX deserialize(String 
text, IUnmarshallingContext ictx)", where XXX is the type being 
converted). That gives you access to all the current parser state 
information, and also to the stack of objects being marshalled or 
unmarshalled. I think I mentioned this change in the release notes for 
1.0, but the tutorial still describes only the single-argument form of 
serializer/deserializers - I'll make a note to update that.

  - Dennis

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



laurent grangier wrote:
> Hello,
>
> I'm writing xml-java binding along with semantic validation using 
> JiBX. I use "deserializer" attribute to specify a method which 
> performs this semantic validation and returns the given string if 
> sucessful or throw an exception if not. For instance, my binding file 
> looks like :
> <value name="LEVEL" field="confidentialityLevel" 
> deserializer="foo.bar.Validation.checkLEVEL" />
>
> I must do this manner because I don't have the control on the Java 
> classes of the binding (an other company is writing them). So I can't 
> use the get and set attribute and put the validation there.
>
> My problem is when there is a validation error, I want to retrieve the 
> tag name where it happened. In the above exemple if the checkLEVEL 
> method checks if the string is equal to "CIVIL" or "DEFENSE" and the 
> xml is not valid, I would like to display to the user which tag is 
> unvalid ("LEVEL" here).
>
> Is there a way to do this ?
>
> Thanks for your answer,
>
> Laurent
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> 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

Reply via email to