0

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.

Alex Marshall
  • 10,162
  • 15
  • 72
  • 117
  • Could you paste some XSD so we could leave out malformed-xsd problems? – Fernando Miguélez Nov 11 '08 at 20:39
  • I've actually since had the chance to redo the whole thing. The XSD I was using was created in Eclipse, edited with their graphical editor, and validated against the W3C validator for XSD schema, so I can safely rule out malformed-xsd problems. – Alex Marshall Feb 22 '09 at 18:55

2 Answers2

0

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

Phil
  • 909
  • 1
  • 10
  • 17
0

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
  • 10,162
  • 15
  • 72
  • 117