You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Simeon Penev <sp...@istac.de> on 2006/04/26 17:43:36 UTC

XML schema extension with 'redefine'-tag

Hi,

i'm using the 'redefine'-tag to extend an already existing XML schema.
When i try to compile the extending schema i get a NullPointerException.
Looking into the code, it came out the problem is in the StscJavaizer
class, which was missing the line:

allSeenTypes.addAll(Arrays.asList(state.redefinedGlobalTypes()));

.. in order to 'javaize' all extending elements.

I also added the following code to the SchemaTypeSystemImpl class, so
the generated beans can compile:

        SchemaType[] result = new SchemaType[_globalTypes.size() +
_redefinedGlobalTypes.size()];
        int j = 0;
        for (Iterator i = _globalTypes.values().iterator(); i.hasNext();
j++)
            result[j] = ((SchemaType.Ref)i.next()).get();
        for (Iterator i = _redefinedGlobalTypes.iterator(); i.hasNext();
j++)
            result[j] = ((SchemaType.Ref)i.next()).get();



However this is just a fast fix and remains just a proposal. Please let
me know if the code is ok and it gets commited to the svn, or some other
fix is applied.

For the code above, see the attached patches.


Best regards,
Simeon Penev