2

I'm trying to generate an XML schema using JAXBContext.generateSchema(..).

My class looks something like this:

@XmlRootElement
@XmlAccessorType( XmlAccessType.FIELD )
class Person {
  @XmlAttribute
  public String name;

  @XmlAnyAttribute
  public Map<QName, String> otherAttributes = new HashMap<QName, String>();
}

And when I generate the schema using the RI, it works fine.

<xsd:attribute name="name" type="xsd:string" />
<xsd:anyAttribute processContents="skip" namespace="##other" />

But when using the generator from MOXy, it switches the order:

<xsd:anyAttribute processContents="skip" namespace="##other" />
<xsd:attribute name="name" type="xsd:string" />

(this is not allowed in XML schema)

Is there a fix for this? I'm using MOXy 2.4.1.

bdoughan
  • 147,609
  • 23
  • 300
  • 400
mortenoh
  • 255
  • 3
  • 17

1 Answers1

2

Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group.

I have entered the following bug for this issue which you can use to track our progress on this issue.

We should have a fix in early in the new year once everyone is back from vacation.

UPDATE

This issue has been fixed in the EclipseLink 2.4.2 and 2.5.0 streams. Any of the nightly builds for these labels starting Dec 28 2012 will contain this fix and are available from the following link:

bdoughan
  • 147,609
  • 23
  • 300
  • 400
  • 1
    Thank you, wasn't 100% sure if it was a bug or not. Just ask if you need the full code (it isn't much). – mortenoh Dec 23 '12 at 14:13