Unexpected JAXB error
Posted
by Mark Lewis
on Stack Overflow
See other posts from Stack Overflow
or by Mark Lewis
Published on 2010-03-29T17:04:51Z
Indexed on
2010/03/29
17:13 UTC
Read the original article
Hit count: 419
Hello,
From the documentation it's clear I need to use the following to get a simple unmarshalling to occur from my XML file/schema:
JAXBContext jc = JAXBContext.newInstance("PackageName");
where PackageName is my package name. I've looked on google for a bit to no avail, to find out why I'm then getting this runtime error:
Line:Col[2:142]:cvc-elt.1: Cannot find the declaration of element 'myconfig'.
Line:Col[2:142]:unexpected element (uri:"http://www.w3.org", local:"myconfig"). Expected elements are <{}myconfig>
Caught UnmarshalException
This occurs at the top of all my class files, including the ones the XJC plugin for eclipse created for me (which I then moved out of PackageName.PackageName which it automatically created):
package PackageName;
so why is this error occurring?
© Stack Overflow or respective owner