> From: Aron Griffis > Sent: Thu, April 14, 2011 2:58:12 PM >
Aron - A few more thoughts about that third problem. > > Third problem: Given the following XSD: > > <?xml version="1.0" encoding="utf-8"?> > <xs:schema xmlns="http://www.hp.com/schemas/bar/2009/12/20" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://www.hp.com/schemas/bar/2009/12/20" > elementFormDefault="qualified" version="1"> > <xs:element name="bar" type="barType"/> > <xs:simpleType name="barType"> > <xs:restriction base="xs:token"> > <xs:enumeration value="foo"/> > <xs:enumeration value="bar"/> > <xs:enumeration value="baz"/> > </xs:restriction> > </xs:simpleType> > </xs:schema> > > I need to be able to instantiate and export a "bar" object, but > the generated file doesn't contain any classes. I think the > problem here is that normally generateDS represents simple > elements as primitive Python values in the XML tree, but we need > a class when the element appears at the top level. > The following is a bit of weaseling, I'll admit, but ... You could consider changing your XML schema to something like the following: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns="http://www.hp.com/schemas/bar/2009/12/20" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.hp.com/schemas/bar/2009/12/20" elementFormDefault="qualified" version="1"> <xs:element name="bar" type="barType"/> <xs:complexType name="barType"> <xs:simpleContent> <xs:restriction base="xs:token"> <xs:enumeration value="foo"/> <xs:enumeration value="bar"/> <xs:enumeration value="baz"/> </xs:restriction> </xs:simpleContent> </xs:complexType> </xs:schema> >From this schema, generateDS.py seems to generate what you'd want. I wish I could claim that I'd thought this out in advance, but even if not, the above seems to be more in line with the way generateDS.py is intended to work. In particular, each complexType is turned into a Python class. I don't know whether you have control over the schema you are working with, but if you do, perhaps the above is a viable solution. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users