On Wed, May 28, 2014 at 10:33:46AM -0400, Chalk, Stuart wrote:
> Anyone seen this error before and know of a solution?
> 
> The schema I am using is attached.  It imports the Dublin Core
> metadata (dcterms) schema for recording bibliographic information.
> 
> The dcterms schema is a valid schema in oxygenxml v 16, yet if I
> take it out the errors go away.
> 
> Thoughts?
> 

Stuart,

I've done a little debugging on this.  And, I actually have a patch.
However, I'm suspicious about this patch.  Here's a little
explanation:

The error that I get when I try to process that schema is:

    RuntimeError: maximum recursion depth exceeded

The infinite loop happens because this schema contains a
substitutionGroup that contains itself. [1]  Or, perhaps not.  It
looks to me as though there is a member of the substitutionGroup has
the same name as the head of that substitutionGroup but is in a
different namespace:

    <xs:element name="title" substitutionGroup="dc:title"/>

However, generateDS.py is not good at separating out multiple
namespaces.  So, you will have to check to see whether the generated
code works for you.  I do not have an XML instance document, so I
can't do that test myself.

At any rate, I've added a check so that when we run generateDS.py,
we're protected against that infinite loop and are able to generate
a module.

I've pushed this fix to Bitbucket.  You can find it here:

    https://bitbucket.org/dkuhlman/generateds

As a bit of additional explanation, and admittedly this is excuse
making, since generateDS.py generates a single module, it can only
generate one class with a given name, even if the schema defines
multiple types with the same name but in different namespaces.  I
suppose that a possible solution would be to generate multiple
modules for different namespaces and link them with Python "import"
statements.  That would require some major reworking of
generateDS.py, I believe.

If this is an issue for you, I don't know whether there is some
reasonable way to *manually* generate separate modules for each
namespace (if those namespaces are defined in separate schema
files).  I suspect that doing so would involve some serious patching
of the generated files.  If you decide to try this, you may want to
look at the following command line options:

    --one-file-per-xsd       Create a python module for each XSD processed.     
    
    --output-directory="XXX" Used in conjunction with --one-file-per-xsd.       
    
                             The directory where the modules will be created.   
    
    --module-suffix="xxx"    To be used in conjunction with --one-file-per-xsd. 
    
                             Append XXX to the end of each file created.        
    

Look here for more information on that:

    
http://www.davekuhlman.org/generateDS.html#one-per-generating-separate-files-from-imported-included-schemas

Hope this helps.  Let me know if you have suggestions or questions,
and especially whether this works for you or what you did to make
it work.

Dave

[1] As a recovering philosophy major, I know that we cannot allow
    sets that contain themselves.  See this Wikipedia page if you
    want to foolishly spend time on that:

        http://en.wikipedia.org/wiki/Russell%27s_paradox

-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to