Greetings,
I have my domain model annotated with JAXB annotations. I am running into couple of issues with
marshalling with Moxy 2.2.0, as it relates to generated XML and namespaces.
1) First, my domain model is spread across different packages. let's say pkg1, pkg2.
* I created a package-info.java to control my namespaces:
pkg1 : package-info.java
@XmlSchema(
namespace = "http://myns",
elementFormDefault = XmlNsForm.QUALIFIED,
atrributeFormDefault = XmlNsForm.UNQUALIFIED,
xmlns = {
@XmlNs(prefix = "me", namespaceURI = "http://myns")
}
)
pkg2: package-info (same thing as above)
@XmlSchema(
namespace = "http://myns",
elementFormDefault = XmlNsForm.QUALIFIED,
atrributeFormDefault = XmlNsForm.UNQUALIFIED,
xmlns = {
@XmlNs(prefix = "me", namespaceURI = "http://myns")
}
)
* Now, I have a domain object i.e in pkg1 which has a root element, but is composed of objects in pkg2.
When I try to marshall my domain object, moxy first of all places the root element in a DEFAULT namespace, completely
ignoring my prefix, it also generates the prefix btw name space. i.e. the xml opening tag looks like these
<root xmlns="http://myns", me:xmlns="http://myns>
<pkg2-type>
<me:pkg2-type1>....
<pkg2-type>
</root>
How can I disable the generation of this default namespace??
2) So I moved all my domain objects to pkg1, now I see I don't see the prefixes for the pkg2 types, but *everything* is in my default namespace,
same as above, how do I make it honor my prefix? Or generate root elements with the prefix?
Thanks!
Regards,
Mohan KR