0

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"/>

Binding :

    <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> 

Generated Class :

    @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;
    ================================

Issue : Trying to generate JAXB Objects from the xsd. The xjc plugin is generating JAXBElements . I am trying to get rid of the JAXBElement generation using a binding. Not successful ? What is wrong with my binding ?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
  • 1
    What's the output (java class) that you expect/want to get? – Clauds Nov 17 '15 at 19:20
  • We are looking for a class public DATA_ds ( private int ARCHIVEPACTID) – user5549845 Nov 17 '15 at 21:09
  • It believe the result you get is because you are using `mixed="true"`. Have a look at the documentation here: https://jaxb.java.net/nonav/2.2.4/docs/api/javax/xml/bind/annotation/XmlMixed.html – Clauds Nov 18 '15 at 09:04
  • Thanks for the link. This resolved the issue – user5549845 Nov 18 '15 at 23:54
  • 1
    Maybe you could post an answer yourself describing what you ended up doing so other people seeing this question can profit from it too? You can also accept your own answer so it's clear that the question is not open any longer. – Clauds Nov 19 '15 at 15:16

0 Answers0