> On Mon, Jan 29, 2007 at 06:11:13PM -0600, David Lambert wrote: > > Dave, > > Please excuse my naive questions, but I am new to XML. I found your > > program generateDS very useful in generating Python from schemas. > > Unfortunately I am having problems with validators using simpleType. I > > have included the following snippet from your documentation in a test > > schema, but cannot find any validate_ methods in the generated code. I > > am sure that I am doing something stupid. Do you have any simple example > > xsd files that demonstrate how to use validation? > > > > Best regards, > > > > Dave. > > > > > > <xs:element name="percent"> > > <xs:simpleType> > > <xs:restriction base="xs:integer"> > > <xs:minInclusive value="1"/> > > <xs:maxInclusive value="100"/> > > </xs:restriction> > > </xs:simpleType> > > > > > David - > > You are right. The above element definition does not trigger the > generation of validators. However, try using the following: > > <xs:element name="person"> > <xs:complexType> > <xs:sequence> > <xs:element name="ratio" type="percent" /> > </xs:sequence> > </xs:complexType> > </xs:element> > > > <xs:simpleType name="percent"> > <xs:restriction base="xs:integer"> > <xs:minInclusive value="1"/> > <xs:maxInclusive value="100"/> > </xs:restriction> > </xs:simpleType> > > This should generate a validator method in the class person. > > However, it does seem to me that generateDS.py should generate > validators for the code that you tried initially. I will have to > look into that. > > By the way, make sure that you are using version 1.9a of > generateDS.py > > More later, after I've done some more checking.
I've added a fix so that the validator methods are also generated when the simpleType occurs inside an <xs:element>. Then new version is at my Web site: http://www.rexx.com/~dkuhlman/generateDS-1.9a.tar.gz I have not yet been able to upload the new version to SourceForge yet, but it will also be at sourceforge.net, soon. Dave (Lambert), thanks for finding this bug and letting me know. It's definitely something that needed to be fixed. Dave (K.) -- Dave Kuhlman http://www.rexx.com/~dkuhlman -- Dave Kuhlman http://www.rexx.com/~dkuhlman ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users