7

I have a simple Java class I am annotating with JAXB:

class Foo {
   @XmlAnyElement(lax=true)
   List<Object> any;
}

Which produces the following schema:

<xs:complexType name="foo">
  <xs:sequence>
    <xs:any processContents="lax" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

Is there any way to set the namespace attribute for the <any> element, so that it generates like:

<xs:any namespace="##targetNamespace" processContents="lax" maxOccurs="unbounded"/>
schmimd04
  • 1,444
  • 3
  • 14
  • 23

1 Answers1

1

insert a package-info.java file into your foo class package with contents like :

@javax.xml.bind.annotation.XmlSchema(namespace = "urn:foo:v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package java.ns.foo;
fla
  • 143
  • 4