Hello Dave,
could it be that this is the reason why its not possible to process fpml (from
main onwards) when I use " --one-file-per-xsd “?
I use generateDS same way as you do in your GitHub repository, one by one at
right now.
Regards
Peter
p.s.
Love your tool! Saves so much time! Thank you!
> On 23 Oct 2016, at 22:56, Dave Kuhlman <dkuhl...@davekuhlman.org> wrote:
>
> On Sun, Oct 23, 2016 at 05:30:55PM +0200, Pietro Saccardi wrote:
>> Hello Dave,
>>
>> my name is Pietro. I recently started using generateDS--great job! it's
>> really useful and works seamlessly out of the box.
>
> Pietro,
>
> Great.
>
>>
>> While testing, I encountered a bug. I wanted to file it to sourceforce, but
>> I am unable to create tickets. I am also not very used to the platform so I
>> may have missed something.
>
> Not so great.
>
> Thanks for reporting this. I'm going to be away traveling for most
> of this week. I've put this on my To-do list, and will look at it when
> I get back.
>
> My recollection is that generateDS.py does not distinguish very
> carefully between <xsd:sequence> and <xsd:choice>. So, this may be
> a pretty deep problem. But, at the least, generateDS.py should not
> generate the silly code that your example shows.
>
> More later.
>
> Dave
>
>>
>> Anyway, I'll describe the bug.
>>
>> Consider such a schema:
>>
>> <xsd:element name="authors">
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:element ref="author"/>
>> <xsd:choice maxOccurs="unbounded" minOccurs="0">
>> <xsd:element ref="author"/>
>> <xsd:element name="cooperation" type="xsd:string"/>
>> </xsd:choice>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>>
>> This will require the <authors> element to have a first child of type
>> <author>, followed by zero or more instances of the elements <author> or
>> <cooperation>.
>>
>> Such schema is not handled correctly in generateDS; it will generate
>> ambiguity between the unique, initial author and the list of author
>> objects. This is an excerpt of the buildChildren method of the authors
>> class:
>>
>> def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
>> if nodeName_ == 'author':
>> obj_ = person.factory()
>> obj_.build(child_)
>> self.author = obj_
>> obj_.original_tagname_ = 'author'
>> elif nodeName_ == 'author':
>> obj_ = person.factory()
>> obj_.build(child_)
>> self.author.append(obj_)
>> obj_.original_tagname_ = 'author'
>> elif nodeName_ == 'cooperation':
>> cooperation_ = child_.text
>> cooperation_ = self.gds_validate_string(cooperation_, node,
>> 'cooperation')
>> self.cooperation.append(cooperation_)
>>
>> As you can see, the second elif will never be reached and any further
>> <author> will override the author property, losing the remaining elements
>> in the list. Also, the exportChildren method will crash, because it will
>> try to enumerate the author property of authors.
>>
>> I changed the structure of my XSD to work around this problem, but I think
>> this should either be remarked in the documentation or fixed.
>>
>> I hope this can be of any use; thank you for your great work on generateDS!
>>
>> Best regards,
>>
>> Pietro Saccardi
>
> --
>
> 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
------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive.
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users