Hi Sanjiv,

Validation can be done by using a StAX parser with validation turned on. 
See the javax.xml.stream.XMLInputFactory JavaDocs from 1.6 or later JDK 
- you basically need to create an instance of this factory class with an 
implementation which supports validation (such as the one supplied by 
Sun as part of their JDKs), then call 
setProperty(XMLInputFactory.IS_VALIDATING, Boolean.TRUE) and create an 
actual parser with a createXMLStreamReader() call. Once you have the 
validating parser for your input, you can use the 
org.jibx.runtime.impl.StAXReaderWrapper constructor to wrap this as an 
IXMLReader instance, which can then be set on your 
org.jibx.runtime.impl.UnmarshallingContext unmarshalling context instance.

I realize that's pretty involved. I've created a Jira to remind me to 
provide an easier way in the future: 
http://jira.codehaus.org/browse/JIBX-381

  - Dennis

Dennis M. Sosnoski
XML 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



Sanjiv wrote:
> Hi,
>
> I am very new to JIBX and I want to validate an xml input file against an xsd
> schema defination. Please help me, and provide some links where some examples
> are given.
>
> Regards,
> Sanjiv
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to