Juha, Thanks for your fix. I've added it to my repository, and I've pushed that change to Bitbucket -- https://bitbucket.org/dkuhlman/generateds
And, to test this change, I also added a pattern containing multi-byte characters to the `tests/validate_simpletypes*` unit test. That meant that I had to change the ExternalEncoding for that test from the default encoding (ascii) to utf-8. Since your use case apparently has xs:simpleType validation patterns that contain multi-byte characters, you might want to be aware of this. You can use the "--external-encoding" command line option to control this. For example, I used: $ generateDS.py --external-encoding="utf-8" ... some_schema.xsd In the case of the unit test, the resulting command line is: $ python generateDS.py \ --no-dates --no-versions --member-specs=list \ -f \ -o tests/validate_simpletypes2_sup.py \ -s tests/validate_simpletypes2_sub.py \ --super=validate_simpletypes2_sup \ --external-encoding="utf-8" \ tests/validate_simpletypes.xsd Hope this helps. Thanks again for your help. I appreciate it. Dave On Fri, Feb 02, 2018 at 04:02:30PM +0200, Juha Tuomala wrote: > > Long lines, see without wordwrap: > > python2.7 ./generateds.hg/build/scripts-2.7//generateDS.py -o einvoice12.py > xsd/1.2/eng/e-invoice_ver1.2.xsd > *** warning. Removing child with duplicate name: "PaymentDescription" > Traceback (most recent call last): > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 7426, in > <module> > main() > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 7414, in main > superModule=superModule) > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 6902, in > parseAndGenerate > prefix, root, options, args, superModule) > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 6712, in > generate > generateFromTree(wrt, prefix, elements, processed) > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 6627, in > generateFromTree > generateClasses(wrt, prefix, element, 0, nameSpacesDef) > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 4987, in > generateClasses > generateValidatorDefs(wrt, element) > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 4712, in > generateValidatorDefs > typeName, stObj.getBase(), element, child) > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 4588, in > getValidatorBody > patterns1) > File "./generateds.hg/build/scripts-2.7//generateDS.py", line 4353, in > processValidatorBodyRestrictions > pats2 = ['^{}$'.format(replaceVbars(p1)) for p1 in pats1] > UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-7: > ordinal not in range(128) > > > https://stackoverflow.com/questions/3235386/python-using-format-on-a-unicode-escaped-string > > > I add 'u' into > > pats2 = ['^{}$'.format(replaceVbars(p1)) for p1 in pats1] > > changed > > pats2 = [u'^{}$'.format(replaceVbars(p1)) for p1 in pats1] > > > making first sting into unicode and it works: > > python2.7 ./generateds.hg/build/scripts-2.7//generateDS.py -o einvoice12.py > xsd/1.2/eng/e-invoice_ver1.2.xsd > *** warning. Removing child with duplicate name: "PaymentDescription" > [tuju@wasa]/net/alca/srv/sys/lib/python2.6/estonia/centralbank% > > > Maybe you could fix this into source repository? I will migrate into python3 > at some > point but whole surrounding system is in 2.7, so it will take time. > > Btw, i first tried pyXB and it made very weird class names, could not use it. > Once I found how to append to generateDS class variables, it works great. > I really like it, thank you very much for coding and sharing it. > > BR, > > Tuju > > > -- > t...@iki.ee | http://tuju.ee | sip:t...@iki.ee | +3726311345 | +3725025337 > Better to have one, and not need it, than to need one and not have it. > > -- 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