JAXB XmlAnyElement sets namespace attribute

I have a simple Java class that I am commenting using JAXB:

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

Creates the following schema:

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

Is there a way to set the namespace attribute for the <any> element so that it is generated as:

 <xs:any namespace="##targetNamespace" processContents="lax" maxOccurs="unbounded"/> 
+7
source share
1 answer

insert the package-info.java file into the package of the foo class with the contents, for example:

 @javax.xml.bind.annotation.XmlSchema(namespace = "urn:foo:v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package java.ns.foo; 
+1
source

All Articles