Currently i am mapping a namespace by creating a package-info.java file for a package with the following annotation.
@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED,
namespace = "http://example.com",
xmlns = {
@XmlNs(prefix = "i",
namespaceURI = "http://www.w3.org/2001/XMLSchema-instance")
})
As you can see one of my namespaces has no prefix whilst the other does, this currently works but i want another way of mapping the namespace without having to create a separate file, anybody have an idea of how i could place the namespace mapping inside my class alongside the annotations?
In my XML the namespaces declarations are inside my root element like below:
<RootElement xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://example.com">...
My class declarations and annotations is like below for the root element.
@XmlRootElement(name="RootElement)
public static class RootElement{
........
}
Thanks.