• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

problem to unmarshal xml file who have element with prefix

 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

with jaxb, i try to read an xml file only a few element in xml file are interesting me, so i would like to skip many element
in class, only field i want exist



my class



before i unmarshal, i put a validation handler i get


if i don't put this validation, no error... but when i check objects value, TimeSeries is null

maybe the problem is the flx prefix?
 
Sheriff
Posts: 28398
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Based on the actual error message you posted, I don't know how you could come to that conclusion. The error message rather clearly says it expected a TimeSeries element in no namespace but instead it found a DocumentHeader element in the namespace represented by your "flx" prefix.

So that's the first problem. Your document has a DocumentHeader element which the class doesn't describe.

However it looks to me like you are going to have a namespace problem. The error message does say it's expecting a TimeSeries element in no namespace, but the TimeSeries element in your document is in a namespace. Perhaps you have to mention that fact in your class?
 
mark smith
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Based on the actual error message you posted, I don't know how you could come to that conclusion. The error message rather clearly says it expected a TimeSeries element in no namespace but instead it found a DocumentHeader element in the namespace represented by your "flx" prefix.

So that's the first problem. Your document has a DocumentHeader element which the class doesn't describe.

However it looks to me like you are going to have a namespace problem. The error message does say it's expecting a TimeSeries element in no namespace, but the TimeSeries element in your document is in a namespace. Perhaps you have to mention that fact in your class?



like i said, only a few element in the xml interest me.... DocumentHeader don't
are we oblige to put every element of the xml in the class?

i come to this conclusion because if i remove prefix of every element in the xml and change my root header for


that work fine.....

i tried to add namespace in my TimeSeries class in the XmlRootElement, i have no error but my TimeSeries class is null
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic