views:

466

answers:

2

Hello,

I have a bit of a problem. I wrote an API a long time ago for our production system, and it used Apache XML Beans. The schema was homogeneous (ie no imports, everything was from within the same schema), and everything worked just fine, even if the code for API handling was incredibly verbose. I've since written a far simpler and more elegant restful API using JAXB, with parts of the old one in mind, ie different schema, but some of the elements are identical. In the hopes of cleaning up and simplifying my binding code in the old API, I've replaced some of the parts by deleting them and importing the new schema and using those elements instead. However, whenever I try to parse documents that use the new mixture of schema, I get a validation error from XML Beans :

error: cvc-complex-type.2.4a: Expected element 'redundant-element@http://www.my.com/old/xmlns' instead of 'redundant-element@http://www.my.com/new/xmlns' here in element redundant-element-list@http://www.my.com/old/xmlns

Has anybody encountered this before ? Have any solutions or ideas ? I'd really appreciate it. Thank you kindly.

A: 

It looks like the namespace in the document is still the old one. Hard to tell without the schemas and documents.

Phil
A: 

Hi Phil,

Thank you kindly for your response. I've tried explicitly adding the new namespace, both on the root of the document and on 'redundant-element' itself, in numerous permutations. IE:

<oldxmlns:root xmlns:oldxmlns="abc" xmnls:newxmlns="xyz">
      .....
</oldxmlns:root>

.. and ...

<oldxmlns:root xmlns:oldxmlns="abc">
   <oldxmlns:nested-element>
         .....
      <newxmlns:redundant-element xmnls:newxmlns="xyz">
           .....
      </newxmlns:redundant-element>
         .....
   </oldxmlns:nested-element>
</oldxmlns:root>

...and I've also tried numerous combinations with default namespaces, etc, and none have worked.

Alex Marshall