Win a copy of Terraform in Action this week in the Cloud forum!

Vipul Bhara

+ Follow
since Aug 12, 2009
Vipul likes ...
Android Ubuntu Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vipul Bhara

I am parsing a very big file using JAXB and trying to avoid unnecessary tags which I dont need, I am trying to just parse some of the grandChildren of the root element, and providing only those classes while creating JAXBContext. When I provide the grandChild class in classes to bound It throws exception, however If I provide the root class in the classes to bound it works.
if I provide this
JAXBContext context = JAXBContext.newInstance(new Class[] {com.parent.class});
It works fine.

but when I try this.
JAXBContext context = JAXBContext.newInstance(new Class[] {com.parent.child.grandChild.class});

It throws following exception

javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"grandChild"). Expected elements are (none)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(

I have generated all classes with XJC. I do have the ObjectFactory in the same place as I have my generated class.
ANy clue, what is going wrong here?
I generated it using XJC only.... I am still getting this exception
I have same question.... I am getting exact error message..
Welcome... will go through table of contents..
10 years ago
Hey Ganesan, will surely go through this one. As Just starting to prepare for SCEA.
All the best for your new software.
Which is the best book for SCDJWS? I have purchased a RFM book, is there any other book that I need to read for SCDJWS?
Will try to read this book, as I am new to spring, so this will be something new to me, All the best for your new book
10 years ago
Finally 3rd edition, Great Work, Was waiting for this book for long time, Will definitely read this book. All the best for your new edition.
10 years ago
All the best for "Android in Action"....
10 years ago
Best of luck for your new book.
11 years ago