You can use an external bindings file to rename one of
the any properties.
binding.xml
<jxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.1">
<jxb:bindings schemaLocation="schema.xsd">
<jxb:bindings
node="//xsd:complexType[@name='foo']/xsd:sequence/xsd:choice/xsd:any[@namespace='http://checklists.nist.gov/sccf/0.1']">
<jxb:property name="any2" />
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
XML Schema (schema.xsd)
Below is a simplified version of your XML schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/schema"
xmlns="http://www.example.org/schema"
elementFormDefault="qualified">
<xsd:complexType name="foo">
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:any namespace=""
minOccurs="1" maxOccurs="unbounded" />
<xsd:any namespace="http://checklists.nist.gov/sccf/0.1"
processContents="skip" minOccurs="1" maxOccurs="unbounded" />
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
XJC Call
Below is how you make an XJC call that leverages an
external binding file.
xjc -b binding.xml schema.xsd
Generated Class (Foo)
package org.example.schema;
import java.util.*;
import javax.xml.bind.annotation.*;
import org.w3c.dom.Element;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "foo", propOrder = {
"any",
"any2"
})
public class Foo {
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAnyElement
protected List<Element> any2;
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
public List<Element> getAny2() {
if (any2 == null) {
any2 = new ArrayList<Element>();
}
return this.any2;
}
}