Hi,
I am generating python classes for xml schema which contains abstract
substitutionGroup. And have problems with references to such elements with
maxOccurance="1".
Here is short example with difficulties i have:
This is my shema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="Head">
<xs:complexType>
<xs:sequence>
<xs:element ref="Animal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Animal" abstract="true"/>
<xs:element name="Dog" substitutionGroup="Animal">
<xs:complexType>
<xs:attribute name="height" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="Snake" substitutionGroup="Animal">
<xs:complexType>
<xs:attribute name="length" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
</xs:schema>
This is first test document:
<Head>
<Dog height="5"/>
</Head>
This is second:
<Head>
<Snake length="5"/>
</Head>
GenerateDS generates classes such that i have in 1st test root object with
property Animal == None and property Dog storing instance of Dog,
in 2nd root object with property Animal == None and property Snake storing
instance of Snake.
I supposed to get property Animal not None and storing instance of Dog or Snake.
Is it right behaviour?
I tried to fix it(patch in attachment).
Leonid Minchin
--- generateDS.py 2014-05-30 22:54:24.000000000 +0400
+++ generateDS_.py 2014-08-06 15:52:01.793762103 +0400
@@ -3502,7 +3502,7 @@
name = substitutionGroup
else:
name = headName
- s1 = " self.%s = obj_\n" % (mappedName, )
+ s1 = " self.%s = obj_\n" % (name, )
wrt(s1)
wrt(" obj_.original_tagname_ = '%s'\n" % (origName, ))
#
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users