I'm facing problem with mapping one model Object (for example: GroupHeader) for different schemas. Each of this schema has different namespace, But some of the complextypes has almost same structure in each of them. So I want map this element to one java Object. Is it possible to achieve this using JAXB?
First schema:
<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02"> <xs:element name="Document" type="Document"/> .... <xs:complexType name="GroupHeader33"> <xs:sequence> <xs:element name="MsgId" type="Max35Text"/> <xs:element name="CreDtTm" type="ISODateTime"/> <xs:element maxOccurs="1" minOccurs="0" name="BtchBookg" type="BatchBookingIndicator"/> <xs:element name="NbOfTxs" type="Max15NumericText"/> <xs:element maxOccurs="1" minOccurs="0" name="CtrlSum" type="DecimalNumber"/> <xs:element maxOccurs="1" minOccurs="0" name="TtlIntrBkSttlmAmt" type="ActiveCurrencyAndAmount"/> <xs:element maxOccurs="1" minOccurs="0" name="IntrBkSttlmDt" type="ISODate"/> <xs:element name="SttlmInf" type="SettlementInformation13"/> <xs:element maxOccurs="1" minOccurs="0" name="PmtTpInf" type="PaymentTypeInformation21"/> <xs:element maxOccurs="1" minOccurs="0" name="InstgAgt" type="BranchAndFinancialInstitutionIdentification4"/> <xs:element maxOccurs="1" minOccurs="0" name="InstdAgt" type="BranchAndFinancialInstitutionIdentification4"/> ...
Second schema:
<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.004.001.02" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:iso:std:iso:20022:tech:xsd:pacs.004.001.02"> ... <xs:complexType name="GroupHeader38"> <xs:sequence> <xs:element name="MsgId" type="Max35Text"/> <xs:element name="CreDtTm" type="ISODateTime"/> <xs:element maxOccurs="2" minOccurs="0" name="Authstn" type="Authorisation1Choice"/> <xs:element maxOccurs="1" minOccurs="0" name="BtchBookg" type="BatchBookingIndicator"/> <xs:element name="NbOfTxs" type="Max15NumericText"/> <xs:element maxOccurs="1" minOccurs="0" name="CtrlSum" type="DecimalNumber"/> <xs:element maxOccurs="1" minOccurs="0" name="GrpRtr" type="TrueFalseIndicator"/> <xs:element maxOccurs="1" minOccurs="0" name="TtlRtrdIntrBkSttlmAmt" type="ActiveCurrencyAndAmount"/> <xs:element maxOccurs="1" minOccurs="0" name="IntrBkSttlmDt" type="ISODate"/> <xs:element name="SttlmInf" type="SettlementInformation13"/> <xs:element maxOccurs="1" minOccurs="0" name="InstgAgt" type="BranchAndFinancialInstitutionIdentification4"/> <xs:element maxOccurs="1" minOccurs="0" name="InstdAgt" type="BranchAndFinancialInstitutionIdentification4"/>
Sorry for my English:)