my dog learned polymorphism
The moose likes XML and Related Technologies and the fly likes Problem with JAXB if new tag is added to XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply locked New topic

Problem with JAXB if new tag is added to XML

Nisha lakshminaraya
Ranch Hand

Joined: Feb 23, 2010
Posts: 33

I have XSD file where i am defining all the XML tags.I am compiling schema to generate all the java class's. I have added new tag to XML and not defined same in XSD. But when i am trying to unmarshall i am getting an error saying "Element not found"

Please help me to solve this

bala nannaka
Ranch Hand

Joined: Apr 02, 2007
Posts: 49
When you unmarshall the xml to generate the java class the Jaxb uses your scema to generate the handlers for each element type and generate a equivalent jave types for that. If you had a new element in xml and not updated in your schema it doen't know to generate a equivalent java type and throws the exception . Please make sure of your all xml elements are matching with the given schema.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19728

I'm locking this duplicate post -- if you want to discuss the question, please reply to the other copy here:
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Problem with JAXB if new tag is added to XML
It's not a secret anymore!