• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAXB 1.0.2 Unmarshal error, 'unexpected root element'

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting the following error while trying to Unmarshal a Document into the java objects that JAXB generated. The instance document does validate against the schema. Here's the error :

"unexpected root element (uri:"", local:"MyRootElement"). Expected elements are....

I Googled this and found a few responses, most of them pertaining to JAXB 2.0, with no clear answer. I suspect that it has to do with namespaces but don't know what to do. I tried a modification of my instance doc that removed all the 'xmlns="..."', 'xmlns:xsi="..."', and 'xsi:schemaLocation="..."' attributes and tried to Unmarshall that version but got the same error.

Since we're only using the one main namespace, none of the elements have any namespace prefixes.

Any suggestions?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic