1

1 つのモデル オブジェクト (例: GroupHeader) を異なるスキーマにマッピングする際に問題に直面しています。このスキーマはそれぞれ異なる名前空間を持っていますが、いくつかの複合型はそれぞれの構造がほぼ同じです。したがって、この要素を 1 つの Java オブジェクトにマップします。JAXBを使用してこれを達成することは可能ですか?

最初のスキーマ:

<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="修飾" targetNamespace="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02">
    <xs:element name="ドキュメント" type="ドキュメント"/>
    ....
       <xs:complexType name="GroupHeader33">
        <xs:シーケンス>
            <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"/>
        
    
    ...
    

2 番目のスキーマ:

<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:シーケンス>
            <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"/>
        
    

私の英語でごめんなさい:)

4

1 に答える 1

0

MOXy の外部マッピング ドキュメントを使用して、複数のマッピングをドメイン モデルに適用できます。

次の例は、処理方法を示しています。違いがある場合:

この例は、小さな違いを処理する方法を示しています。

于 2012-02-28T16:01:37.907 に答える