1

I am trying to generate java objects for below XML. Steps followed

I understand that problem is be with the xml. but I am not able to find exact problem because of which I am not getting proper xsd.

Below is the xml and xsd

XML


<?xml version="1.0" encoding="UTF-8"?>
<n1:RFPBatchFile xmlns:n1="http://ap.com/xsd/message/iso20022/RFPBatchInput" xmlns:ba="urn:iso:std:iso:20022:tech:xsd:head.001.001.01" xmlns:rain1="urn:iso:std:iso:20022:tech:xsd:rain.001.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ap.com/xsd/message/iso20022/RFPBatchInput">
   <n1:Hdr>
      <n1:FileTp>RFPInputFromDistributor</n1:FileTp>
      <n1:FileRef>Sp22_RFP_0609_02</n1:FileRef>
      <n1:SndgPty>
         <n1:Id>000196</n1:Id>
         <n1:Tp>DSTR</n1:Tp>
      </n1:SndgPty>
      <n1:RcptPty>
         <n1:Id>ZAPP</n1:Id>
         <n1:Tp>SCHM</n1:Tp>
      </n1:RcptPty>
      <n1:FileBusDt>2019-06-03T18:30:23Z</n1:FileBusDt>
   </n1:Hdr>
   <n1:LogclFile>
      <n1:LogclHdr>
         
            <n1:Id>ZAPP</n1:Id>
            <n1:Tp>SCHM</n1:Tp>
        
      </n1:LogclHdr>
      <n1:Message>
         
            <n1:MsgRef>MSG_001</n1:MsgRef>
           
      </n1:Message>
      <n1:LogclTrlr>
         <n1:NbOFTxs>2</n1:NbOFTxs>
      </n1:LogclTrlr>
   </n1:LogclFile>
   <n1:Trlr>
      <n1:LogclFileCnt>1</n1:LogclFileCnt>
   </n1:Trlr>
</n1:RFPBatchFile>

XSD

<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Technologies Online Tools 1.0 (https://www.liquid-technologies.com) -->
<xs:schema xmlns:ba="urn:iso:std:iso:20022:tech:xsd:head.001.001.01" xmlns:n1="http://ap.com/xsd/message/iso20022/RFPBatchInput" xmlns:rain1="urn:iso:std:iso:20022:tech:xsd:rain.001.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ap.com/xsd/message/iso20022/RFPBatchInput" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="RFPBatchFile">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Hdr">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="FileTp" type="xs:string" />
              <xs:element name="FileRef" type="xs:string" />
              <xs:element name="SndgPty">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Id" type="xs:unsignedByte" />
                    <xs:element name="Tp" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="RcptPty">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Id" type="xs:string" />
                    <xs:element name="Tp" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="FileBusDt" type="xs:dateTime" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="LogclFile">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="LogclHdr">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Id" type="xs:string" />
                    <xs:element name="Tp" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="Message">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="MsgRef" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="LogclTrlr">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="NbOFTxs" type="xs:unsignedByte" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Trlr">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="LogclFileCnt" type="xs:unsignedByte" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Console Logs

[INFO] Building jaxb-xsd-example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] 
[INFO] --- maven-jaxb2-plugin:0.13.3:generate (default) @ jaxb-xsd-example ---
[WARNING] The POM for org.glassfish.jaxb:jaxb-runtime:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.glassfish.jaxb:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.glassfish.jaxb:txw2:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.glassfish.jaxb:jaxb-xjc:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.glassfish.jaxb:codemodel:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind.external:rngom:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.istack:istack-commons-tools:jar:2.21 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] Sources are not up-to-date, XJC will be executed.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.529 s
[INFO] Finished at: 2020-06-25T20:22:07+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.3:generate (default) on project jaxb-xsd-example: Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.3:generate failed: Prefix '' is already bound to '' -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Sridhar Patnaik
  • 970
  • 1
  • 13
  • 24
  • You can not generate classes, or you can not create objects? What error are you getting? – k5_ Jun 25 '20 at 14:31
  • @k5_ After trying for some more time, now I am not seeing any error but objects are not getting generated. I have pushed code to public repo so that you can debug. Thank you in advance https://github.com/bsridharpatnaik/jaxb-trial – Sridhar Patnaik Jun 25 '20 at 15:06

0 Answers0