> From: "Merket, Noel" <[email protected]>
> Sent: Thu, December 9, 2010 9:20:18 AM
> Hi,
>
> I'm a relative newcomer to generateDS and am excited about the
> possibilities of using it for my application. I am having problems
> with it however converting to the correct types from the xsd to the
> python data structure. For example I have defined an element:
>
> <xs:element name="AHLeakSA" type="AHLeakSAType" minOccurs="0">
> <xs:annotation>
> <xs:documentation>Fraction of air-handler flow rate that is lost
> on
>the supply-side of the air-handler.</xs:documentation>
> </xs:annotation>
> </xs:element>
>
> With the simpleType declaration later on as:
>
> <xs:simpleType name="AHLeakSAType">
> <xs:restriction base="xs:double">
> <xs:minInclusive value="0"/>
> <xs:maxInclusive value="1"/>
> </xs:restriction>
> </xs:simpleType>
>
> However in the code from generateDS, it comes through as a string
> when I would expect a float.
>
> def buildChildren(self, child_, nodeName_, from_subclass=False):
> if nodeName_ == 'SupplyLeak':
> SupplyLeak_ = child_.text
> self.SupplyLeak = SupplyLeak_
> self.validate_SupplyLeak(self.SupplyLeak) # validate type
>SupplyLeak
> elif nodeName_ == 'ReturnLeak':
> ReturnLeak_ = child_.text
> self.ReturnLeak = ReturnLeak_
> self.validate_ReturnLeak(self.ReturnLeak) # validate type
>ReturnLeak
> elif nodeName_ == 'AHLeakSA':
> AHLeakSA_ = child_.text
> self.AHLeakSA = AHLeakSA_
> self.validate_AHLeakSA(self.AHLeakSA) # validate type AHLeakSA
>
> What am I doing wrong here? I'm using generateds 2.2b.
Noel -
I do not believe that generateDS.py will support restrictions on a
simpleType. I just recently did some work to add some support for
restrictions on a complexType.
I'd recommend that you change it to something like the following:
<xs:element name="AHLeakSA" type="xs:double" minOccurs="0">
<xs:annotation>
<xs:documentation>Fraction of air-handler flow rate that is
lost on the supply-side of the air-handler.</xs:documentation>
</xs:annotation>
</xs:element>
That's about the best that generateDS.py can do right now, I'm
afraid. Will that work for you. I'll give it a test myself, tomorrow.
And, I'll take another look to see if there is a simple fix for this.
- Dave
--
Dave Kuhlman
http://www.rexx.com/~dkuhlman
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
generateds-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/generateds-users