• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem to unmarshal xml file who have element with prefix

 
mark smith
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • 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?
 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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: 256
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic