|
Re: Recurring Element Support [message #653325 is a reply to message #653311] |
Wed, 09 February 2011 11:49 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Rob,
Comments below.
Rob wrote:
> Hi, I have tried working with the following schema:
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://example.com/RecurringElements"
> targetNamespace="http://example.com/RecurringElements">
> <xs:element name="BoatElement" type="Boat"/>
> <xs:complexType name="Boat">
> <xs:sequence>
> <xs:element name="power" type="xs:string" minOccurs="3"
> maxOccurs="3"/>
> <xs:element name="hulltype" type="xs:string" minOccurs="1"
> maxOccurs="1"/>
> <xs:element name="power" type="xs:string" minOccurs="3"
> maxOccurs="3"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
> It will create the EMF code OK, creating a getPower and getPower1 set
> of methods as expected. If you use the Java code to populate it works
> OK, however if you perform a load on the following XML:
>
> <n1:BoatElement
> xsi:schemaLocation="http://example.com/RecurringElements
> RecurringElements.xsd" xmlns:n1="http://example.com/RecurringElements"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <power>String1</power>
> <power>String2</power>
> <power>String3</power>
> <hulltype>String4</hulltype>
> <power>String5</power>
> <power>String6</power>
> <power>String7</power>
> </n1:BoatElement>
>
>
> It will load all of the power elements into the first "getPower" and
> none into the second "getPower1".
>
> Is this a known issue - I'm guessing so, but thought that I would check.
I think I previously mentioned that repeating the same particle more
than once in the content model will cause issues. The handler will
always find the first matching feature and will not take into account
the extent to which that feature is already populated. We'd need more
of a state machine type of approach to handle these kinds of cases (like
the patch in the oldest open bugzilla).
>
> Thanks, Rob
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03125 seconds