Nicolas,

Thanks for this report.  And, thank you for providing the schema to
test against.  With your schema, I was able to reproduce the error.

I believe the problem occurs because you have things like the
following in your schema:

    <xs:simpleType name="string">
        <xs:restriction base="xs:string"/>
    </xs:simpleType>

Because generateDS.py ignores the namespace prefix ("xs:"), that
definition effectively (1) redefines a primitive type and (2)
defines a type as a restriction of itself.  The schema does
something similar with the primitive type xs:integer and several
others.

generateDS.py should be able to protect itself against this.

I made a change, and that change eliminated the infinite recursion
error that we're seeing.  But, with that change, I believe that
generateDS.py is not handling simpleType validation quite correctly.

So, give me a little more time.

Dave

On Tue, Jan 16, 2018 at 09:26:21AM +0100, Nicolas de Saint Jorre wrote:
>    Dear Mister Kuhlman,
>    I am trying to use your XML converter but I am having trouble using it.
>    I am not a Pro with Python but I try to learn and to improve everyday.
>    So here I am trying to convert into a Django Models and Forms from the
>    attached XSD specification.
>    I have the following error:
>    (dev)
>    nicolas@nicolas-XPS-13-9343:~/Downloads/dkuhlman-generateds-cba0ef052d1e$
>    python generateDS.py -o odm1-3-2.py -s odm1-3-2subs.py
>    Demos/People/ODM1-3-2.xsd 
>    *** warning.  Removing child with duplicate name: "KeySet"
>    *** warning.  Removing child with duplicate name: "Signature"
>    *** warning.  Removing child with duplicate name: "PGPKeyPacket"
>    *** warning.  Removing child with duplicate name: ""
>    File odm1-3-2.py exists.  Overwrite? (y/n): y
>    Traceback (most recent call last):
>      File "generateDS.py", line 7417, in <module>
>        main()
>      File "generateDS.py", line 7405, in main
>        superModule=superModule)
>      File "generateDS.py", line 6893, in parseAndGenerate
>        prefix, root, options, args, superModule)
>      File "generateDS.py", line 6704, in generate
>        generateFromTree(wrt, prefix, elements, processed)
>      File "generateDS.py", line 6619, in generateFromTree
>        generateClasses(wrt, prefix, element, 0, nameSpacesDef)
>      File "generateDS.py", line 4979, in generateClasses
>        generateValidatorDefs(wrt, element)
>      File "generateDS.py", line 4736, in generateValidatorDefs
>        typeName, stObj.getBase(), None, None)
>      File "generateDS.py", line 4580, in getValidatorBody
>        patterns1)
>      File "generateDS.py", line 4552, in processValidatorBodyRestrictions
>        base1, patterns1)
>      File "generateDS.py", line 4552, in processValidatorBodyRestrictions
>        base1, patterns1)
>      File "generateDS.py", line 4552, in processValidatorBodyRestrictions
>        base1, patterns1)
>      [Previous line repeated 979 more times]
>      File "generateDS.py", line 4544, in processValidatorBodyRestrictions
>        st1 = find_simple_type_def(tree, base1, None, None, ns, base)
>      File "generateDS.py", line 4269, in find_simple_type_def
>        namespaces=ns, n=stName)
>      File "src/lxml/etree.pyx", line 1586, in lxml.etree._Element.xpath
>    (src/lxml/etree.c:61218)
>      File "src/lxml/xpath.pxi", line 261, in
>    lxml.etree.XPathElementEvaluator.__init__ (src/lxml/etree.c:178111)
>      File "src/lxml/xpath.pxi", line 133, in
>    lxml.etree._XPathEvaluatorBase.__init__ (src/lxml/etree.c:176304)
>      File "src/lxml/xpath.pxi", line 57, in
>    lxml.etree._XPathContext.__init__ (src/lxml/etree.c:175253)
>      File "src/lxml/extensions.pxi", line 76, in
>    lxml.etree._BaseContext.__init__ (src/lxml/etree.c:164013)
>    RecursionError: maximum recursion depth exceeded while calling a Python
>    object
>    Do you think you could help me here?
>    I would love to see how your code is going to convert this complex XSD
>    into an easy to use Django models...
>    Thank you in advance for your help.
>    Best regards from France, 
> 
>    Nicolas de Saint Jorre
>    1 Rue Chanoine Durville, 44000 Nantes
>    Quanticsoft - The Webtrial Solution
>    Mob. +33 603342228
>    Tél. +33 972212461







-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to