>From: Sasha Case >Sent: Tue, July 27, 2010 5:14:01 AM > > Hi Dave, > > I've been investigating using generateDS for a project at work, and > have found it very promising so far. Thanks for sharing it! I've > hit one problem which I will look at fixing, but I thought I would > email you first to see if you have any thoughts. > > I have an .xsd fragment that looks like: > > <xs:sequence maxOccurs="unbounded"> > <xs:element name="name" type="xs:string"/> > <xs:element name="address" type="hw:nvmAddressType"/> > <xs:element name="value" type="blk:one-byte-hex-string"/> > </xs:sequence> > > What I would expect generateDS to do is "inherit" the maxOccurs > from the sequence, so that name, address and value are all treated > as lists within Python. I've found that this does not work. It > seems to do what I expect for a choice type element, but not a > sequence. Is there a reason for this, is there a workaround, or do > you think it is a change that I could make? > > Thanks >
Sasha - I believe that you are right. generateDS.py does not support this. I looked (just now) at "XML Schema Part 1: Structures Second Edition" and I see that yes you can put minOccurs and maxOccurs attributes on the <xs:sequence> element. http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#element-sequence However, I don't know what it means. Here is a quote from the above document: Schema Component Constraint: Effective Total Range (all and sequence) ======================================================================= The effective total range of a particle whose {term} is a group whose {compositor} is all or sequence is a pair of minimum and maximum, as follows: minimum --------- The product of the particle's {min occurs} and the sum of the {min occurs} of every wildcard or element declaration particle in the group's {particles} and the minimum part of the effective total range of each of the group particles in the group's {particles} (or 0 if there are no {particles}). maximum --------- unbounded if the {max occurs} of any wildcard or element declaration particle in the group's {particles} or the maximum part of the effective total range of any of the group particles in the group's {particles} is unbounded, or if any of those is non-zero and the {max occurs} of the particle itself is unbounded, otherwise the product of the particle's {max occurs} and the sum of the {max occurs} of every wildcard or element declaration particle in the group's {particles} and the maximum part of the effective total range of each of the group particles in the group's {particles} (or 0 if there are no {particles}). If both the <xs:sequence> and a nested element have a minOccurs attribute, how do you calculate the minimum for the nested element? I believe that the quote above answers that question, but I'm not sure it does and I do not understand what it means. And, I've a similar question about maxOccurs. Can you give me any help on that? Perhaps you could give me a link to an explanation. I would have thought that an inner minOccurs overrides an outer level one. But, the above quote seems to be saying that there is addition (a sum) involved. Am I looking at the wrong place. I'll be out of town visiting my sweet heart in Tuolumne Meadows in Yosemite for the rest of the week, where she is doing volunteer work giving advice and answering questions for visitors. I'm in Sacramento, CA. We have some spectacular scenery here in California, some of it as good as Australia, but I'd love to see a bit of Australia some day. I'll look into this when I get back next week. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users