ManishKG@SunMy Work At Sun |
|
Wednesday Apr 25, 2007
JAXB Tip
If you are using JAXB for XML to Java binding and geting javax.xml.bind.UnmarshalException: Unexpected element blah blah blah... the first thing you can do is to call setValidating(true) on Unmarshaller object. i.e. JAXBContext jc = JAXBContext.newInstance("com.sun.java.xml.ns.portlet.portlet_app_2_0"); This will help in getting little more details about the problem. For example, if your schema has declared <sequence> constraints on certain elements and your XML is not following it, the validation handler will report that certain tag name (element) is NOT allowed at this place and what all possible elements can appear after certain element. One caveat here - setValidating() is a deprecated method and should be used only for debugging purpose. Posted at 03:28PM Apr 25, 2007 by manishkg in Sun | Comments[2] |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Posted by Michael on June 11, 2007 at 02:04 PM IST #
Posted by Manish on June 11, 2007 at 02:32 PM IST #