Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Recurring Element Support(Load not populating)
Recurring Element Support [message #653311] Wed, 09 February 2011 10:19 Go to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
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.

Thanks, Rob
Re: Recurring Element Support [message #653325 is a reply to message #653311] Wed, 09 February 2011 11:49 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30554
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
Previous Topic:Removing target objects from cross-referenced resource
Next Topic:[CDO] Confused about the source of the source
Goto Forum:
  


Current Time: Tue Oct 22 06:01:36 GMT 2019

Powered by FUDForum. Page generated in 0.01762 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top