MOXy - specify element form in external bindings [message #812135] |
Sat, 03 March 2012 04:11  |
Eclipse User |
|
|
|
Hi,
could anyone please tell me if it is possible to specify element form
using external bindings?
What I'm trying to achieve is mapping for the following example xsd
(showing just a fragment):
<schema targetNamespace="myNS"
elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="myNS">
<element name="MESSAGE" type="tns:SomeTypeName" />
<complexType name="SomeTypeName">
<sequence>
<element name="HEADER" type="tns:Header" form="unqualified" />
</sequence>
</complexType>
</schema>
I'd like to have an external mapping document that is able to produce
such a representation:
<m:MESSAGE>
<HEADER>
...
</HEADER>
</m:MESSAGE>
Root qualification should be addressed by <xml-ns> element in an
external binding document.
But how do I instruct MOXy that the HEADER element should be unqualified?
Thanks,
Tom
|
|
|
Re: MOXy - specify element form in external bindings [message #814100 is a reply to message #812135] |
Mon, 05 March 2012 22:01   |
Eclipse User |
|
|
|
Hi Tom,
There looks to be a bug in our bindings file support with regards to this scenario, we have reproduced it and should have an update soon.
For what it's worth, the equivalent annotations do work:
[package-info.java]
@javax.xml.bind.annotation.XmlSchema(
xmlns = {
@javax.xml.bind.annotation.XmlNs(prefix = "m",
namespaceURI="myNS")
},
namespace = "myNs",
attributeFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package example;
[Sample.java]
@XmlRootElement(name="MESSAGE",namespace="myNS")
public class Sample {
@XmlElement(name="HEADER",namespace="")
public String foo = "info";
}
Thanks,
Rick Barkhouse
EclipseLink
[Updated on: Mon, 05 March 2012 22:25] by Moderator
|
|
|
|
|
Re: MOXy - specify element form in external bindings [message #816322 is a reply to message #815579] |
Thu, 08 March 2012 12:56  |
Eclipse User |
|
|
|
Thanks, that actually works. Somehow I couldn't get it to work at the
beginning - I was looking for 'form' option but then found that
specifying namespace='' achieves the expected result.
On 07.03.2012 21:48, Rick Barkhouse wrote:
> is issue, yes, specifying namespace="" should achieve what you want.
> Was this not working for you?
|
|
|
Powered by
FUDForum. Page generated in 0.03719 seconds