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
[email protected]
https://lists.sourceforge.net/lists/listinfo/generateds-users