Плагин XJC: MAVEN, генерирующий классы JAXBElement
Maven:
<execution>
<id>cdm-generate-Oracle</id>
<goals>
<goal>
generate</goal>
</goals>
<configuration>
<schemaDirectory>src\main\resources\xsd\clients</schemaDirectory>
<verbose>true</verbose>
<schemaIncludes>
<include>*.xsd</include>
</schemaIncludes>
<bindingDirectory>src\main\resources\xsd\clients</bindingDirectory>
<bindingIncludes>
<bindingInclude>*.xjb</bindingInclude>
</bindingIncludes>
<generatePackage>com.adp.smartconnect.client.oraclecloud</generatePackage>
<clearOutputDir>true</clearOutputDir>
<generateDirectory>src/main/java</generateDirectory>
</configuration>
</execution>
XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.adp.com/smartclound/v0.9"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xoracle="http://www.adp.com/smartclound/v0.9" elementFormDefault="qualified">
<xsd:element name="DATA_DS">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="ARCHIVEPACTID" minOccurs="0" type="xsd:int"/>
<xsd:element name="DELIVERYOPTIONID" minOccurs="0" type="xsd:long"/>
<xsd:element name="PAYROLLACTIONID" minOccurs="0" type="xsd:int"/>
<xsd:element name="G_1" minOccurs="0">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="FILE_FRAGMENT" minOccurs="0">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="PAYSLIP" minOccurs="0">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="REP_CATEGORY_NAME"
minOccurs="0" type="xsd:normalizedString"/>
<xsd:element name="parameters" minOccurs="0">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="request_id" minOccurs="0"
type="xsd:long"/>
<xsd:element name="FLOW_NAME" minOccurs="0"
type="xsd:string"/>
Связывание:
<jaxb:bindings version="2.1"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:bindings schemaLocation="file:/C:/Murali-CDM/src/main/resources/xsd/clients/USOnlinePayslip_GSE_R9_062415.xsd" node="/xs:schema">
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
</jaxb:bindings>
Генерируемый класс:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
@XmlRootElement(name = "DATA_DS")
public class DATADS {
@XmlElementRefs({
@XmlElementRef(name = "ARCHIVEPACTID", namespace = "http://www.adp.com/smartclound/v0.9", type = JAXBElement.class, required = false),
@XmlElementRef(name = "DELIVERYOPTIONID", namespace = "http://www.adp.com/smartclound/v0.9", type = JAXBElement.class, required = false),
@XmlElementRef(name = "G_1", namespace = "http://www.adp.com/smartclound/v0.9", type = JAXBElement.class, required = false),
@XmlElementRef(name = "PAYROLLACTIONID", namespace = "http://www.adp.com/smartclound/v0.9", type = JAXBElement.class, required = false)
})
@XmlMixed
protected List<Serializable> content;
================================
Проблема: Попытка сгенерировать объекты JAXB из xsd. Плагин xjc генерирует элементы JAXBElements . Я пытаюсь избавиться от поколения JAXBElement с помощью привязки. Не успешный? Что не так с моей привязкой?