binding.xml
You can use the following external binding file to generate the type of property you are looking for:
<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
version="2.1">
<globalBindings choiceContentProperty="true"/>
</bindings>
XJC Call
The binding file is referenced using the -b
flag.
xjc -b binding.xml schema.xsd
Generated Property
Now the following property will be generated:
@XmlElements({
@XmlElement(name = "path", type = String.class),
@XmlElement(name = "file", type = byte[].class)
})
protected Object pathOrFile;
For More Information