Importing and Using an External Schema Using XML Beans

I have a problem. I wrote an API for our production system a long time ago and used Apache XML Beans. The schema was homogeneous (i.e. no import, everything was from within the same schema) and everything worked fine even if the code to handle the API was incredibly verbose. Since then I have written a much simpler and more elegant custom API using JAXB, with parts of the old, i.e. With a different circuit, but some of the elements are identical. In hopes of cleaning up and simplifying the binding code in the old API, I replaced some parts by removing them and importing the new schema and using those elements. However, whenever I try to parse documents that use a 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 anyone encountered this before? Are there any solutions or ideas? I would really appreciate it. Thank you.

0


source to share


2 answers


Thank you for your answer. I tried to explicitly add the new namespace, both in the document root and in the "redundant" element, 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 have also tried many combinations with default namespaces, etc. and none worked.

0


source


It looks like the namespace in the document is still the old one. It's hard to say without diagrams and documents.



0


source







All Articles