Please shed some light on JAXBContext configutation. Given:
- customer library
com.mycompany.user01234
with several JAXB-annotated classes - all classes are simple POJOs located in the same package
- classes are annotated by
@XmlType
Customer marshals instance of com.mycompany.user01234.UserClass1.class
to the server via web service endpoint. On the server side I do the following:
JAXBContext jbc = JAXBContext.newInstance("com.mycompany.user01234")
Unmarshaller um = jbc.createUnmarshaller();
JAXBElement<Object> element = um.unmarshal(source, Object.class);
Object customerInput = element.getValue();
And it works fine ONLY if I patch customer library with following package-info.java
:
@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED)
package com.mycompany.user01234;
To my shame I havent found any clear explanation of what this @XmlNsForm
annotation is and how it affects unmarshalling process. This is the first question.
The second question is whether it is possible (in the given layout) to put that QUALIFIED
value into some properties or defaults for JAXBContext
or use other non-declarative means allowing to get rid of package-info.java
.
Many thanks in advance!