Hi,
I have to add xml schema attributes into the java object.
Such as, my java object is User. This User object will be
represented as XML using JAXB. I generated XML
from User object successfully using JAXB. But I want to add xml schema attributes. For example:
<User
xmlns="http://testws/rest/schema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://testws/rest/user UserSchema.xsd" >
</User>
How do I add xmlns, xmlns:xsi, xsi:schemaLocat ion attributes in the User (root) element, using JAXB?
I tried with @xmlSchema annotation but it threw the following error:
Package annotations must be in file package-info.java
I would be grateful, if someone help me to solve this issue.
I have to add xml schema attributes into the java object.
Such as, my java object is User. This User object will be
represented as XML using JAXB. I generated XML
from User object successfully using JAXB. But I want to add xml schema attributes. For example:
<User
xmlns="http://testws/rest/schema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://testws/rest/user UserSchema.xsd" >
</User>
How do I add xmlns, xmlns:xsi, xsi:schemaLocat ion attributes in the User (root) element, using JAXB?
I tried with @xmlSchema annotation but it threw the following error:
Package annotations must be in file package-info.java
I would be grateful, if someone help me to solve this issue.
Comment