3 Replies Latest reply: Oct 25, 2010 9:56 AM by 796311 RSS

    JAXB XML Binding always outputs ns2 but i need it to ns1

    807911
      I am writing an xml file to conform with a standard:

      <NibbsPaymentCollection>
      <ns1:NibbsPayment>
      <ns1:serialNumber>123456</ns1:serialNumber>
      <ns1:beneficiary>Ola Tobi</ns1:beneficiary>
      <ns1:amount>24500.00</ns1:amount>
      <ns1:accountNumber>34566767908</ns1:accountNumber>
      <ns1:sortCode>234</ns1:sortCode>
      <ns1:transactionDescription>Test message 1</ns1:transactionDescription>
      </ns1:NibbsPayment>
      <ns1:NibbsPayment>
      <ns1:serialNumber>123457</ns1:serialNumber>
      <ns1:beneficiary>Ola Eben</ns1:beneficiary>
      <ns1:amount>24500.00</ns1:amount>
      <ns1:accountNumber>234456666</ns1:accountNumber>
      <ns1:sortCode>234</ns1:sortCode>
      <ns1:transactionDescription>Test message 2</ns1:transactionDescription>
      </ns1:NibbsPayment>
      </NibbsPaymentCollection>


      But the closest i got was:

      <NibbsPaymentCollection xmlns:ns2="ns1">
      <ns2:NibbsPayment>
      <ns2:serialNumber>123456</ns2:serialNumber>
      <ns2:beneficiary>Ola Tobi</ns2:beneficiary>
      <ns2:amount>24500.00</ns2:amount>
      <ns2:accountNumber>34566767908</ns2:accountNumber>
      <ns2:sortCode>234</ns2:sortCode>
      <ns2:transactionDescription>Test message 1</ns2:transactionDescription>
      </ns2:NibbsPayment>
      <ns2:NibbsPayment>
      <ns2:serialNumber>123457</ns2:serialNumber>
      <ns2:beneficiary>Ola Eben</ns2:beneficiary>
      <ns2:amount>24500.00</ns2:amount>
      <ns2:accountNumber>234456666</ns2:accountNumber>
      <ns2:sortCode>234</ns2:sortCode>
      <ns2:transactionDescription>Test message 2</ns2:transactionDescription>
      </ns2:NibbsPayment>
      </NibbsPaymentCollection>

      I've tried to tweak the annotations, but i couldn't make ns2 become ns1.

      Any helpful comment is welcome.