简体   繁体   中英

Jaxb validation error

I'm getting this error while trying to de-serialize my object :

[org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'ObjectProp' is not complete. One of '{"http://localhost/txt/1.12/obj/domain":MapProp}' is expected.]

But my xml is like this :

<ObjectProp type="single">
   <MapProp sn="79" version="7.0">

...

As you ObjectProp does contain MapProp, what can be wrong, did anyone experience this before?

The exception is indicating that the XML should be namespace qualified like:

<ObjectProp type="single">
   <MapProp xmlns="http://localhost/txt/1.12/obj/domain" sn="79" version="7.0">
      ...
   </MapProp>
</ObjectProp>

For more info on JAXB & Namespaces:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM