Lavanya, Thank you for your report and suggested fix.
I'll take a look. Dave On Tue, May 15, 2018 at 12:11:36PM +0000, Poondru, Lavanya - FAS GmbH wrote: > Dear Mr. Kuhlman, > > > > Thank you very much for making a super successful project generateDS.py > which generates Python data structures from an XSD schema. > > > > I want to report a bug concerning the parser generated using generateDS: > > > > I have an XML document which contains header as below: > > > > <header> > > <language_version>2.0</language_version> > > <author>TTX-Mwcodegenerator</author> > > <date_creation></date_creation> > > <date_change/> > > <description>SET</description> > > </header> > > > > The corresponding schema is as below: > > > > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema elementFormDefault="qualified" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:adtf="adtf"> > <xsd:complexType name="Header"> > > <xsd:sequence> > <xsd:element name="language_version" type="xsd:string" > minOccurs="1"></xsd:element> > <xsd:element name="author" type="xsd:string" > minOccurs="1"></xsd:element> > <xsd:element name="date_creation" type="xsd:string" > minOccurs="1"></xsd:element> > <xsd:element name="date_change" type="xsd:string" > minOccurs="1"></xsd:element> > <xsd:element name="description" type="xsd:string" > minOccurs="1"></xsd:element> > <xsd:element name="ext_declaration" type="ExtDeclaration" > minOccurs="0" maxOccurs="unbounded"></xsd:element> > </xsd:sequence> > </xsd:complexType> > > </xsd:schema> > > > > The parser generated using generateDS fails using the above schema. The > failure occurs in generateDS.py where in the definition of > generateBuildStandard_1: a condition says: > > > > if PreserveCdataTags: > > wrt(" mo_ = > PRESERVE_CDATA_TAGS_PAT.search(""etree_.tostring(child_).strip())\n") > wrt(" %s_ = mo_.group(1)\n" % name) > > > > here the case is not considered if mo_ can be None . By adding a try > except block could solve the problem. > > > > if PreserveCdataTags: > > wrt(" mo_ = > PRESERVE_CDATA_TAGS_PAT.search(""etree_.tostring(child_).strip())\n") > > wrt(“try :”) > wrt(" %s_ = mo_.group(1)\n" % name) > > wrt(“except:”) > > wrt(" %s_ = ‘ ’\n" % name) > > > > Thank you very much. A release might be really helpful. > > > > Best Regards > > Lavanya > > > > -- 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