Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » 2-element XSD sequence model implementation
2-element XSD sequence model implementation [message #830410] Tue, 27 March 2012 15:33 Go to next message
Roded Bahat is currently offline Roded BahatFriend
Messages: 152
Registered: August 2011
Senior Member
Hi,
I'm trying to model the following XSD in Sapphire:
<xs:element name="resources">
    <xs:complexType>
        <xs:sequence>
	    <xs:element name="locale" type="Locale"></xs:element>
	    <xs:element name="bundle" maxOccurs="unbounded" type="ResourceBundle"></xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

I'd like the locale & bundle elements to have a 1:1 relationship, so I've created a container model element (IResourceLocaleBundle) which holds an implied element for each child element ("locale" and "bundle").

Parent list:
	// *** ResourceLocaleBundles ***
	@Type(base = IResourceLocaleBundle.class)
	@Label(standard = "Resource Locale Bundles")
	ListProperty PROP_RESOURCE_LOCALE_BUNDLES = new ListProperty(TYPE, "ResourceLocaleBundles");
	ModelElementList<IResourceLocaleBundle> getResourceLocaleBundles();

Now, I'd like to bind the parent list property and IResourceLocaleBundle to nothing so that the locale and bundle elements appear coupled directly under the root element.
Should I be implementing a custom list & element binding impl for this purpose? Is there a better way to accomplish this?
I'd appreciate any comments.
Thanks,
Roded
Re: 2-element XSD sequence model implementation [message #830464 is a reply to message #830410] Tue, 27 March 2012 17:08 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
Not quite understanding all aspects of your question, but based purely on your schema snippet... I would likely create

IResources (bound to "resources" element)
{
    Locale (implied element property bound to "locale" element)
    Bundles (list property bound to "bundle" elements)
}

None of the above should require a custom binding.

- Konstantin
Re: 2-element XSD sequence model implementation [message #830546 is a reply to message #830464] Tue, 27 March 2012 19:29 Go to previous message
Roded Bahat is currently offline Roded BahatFriend
Messages: 152
Registered: August 2011
Senior Member
My mistake, I've had the wrong conception of xs:sequence.
Your solution is exactly it.
Thanks
Previous Topic:tool palette action override
Next Topic:Refreshing a ContentProposalService
Goto Forum:
  


Current Time: Tue Apr 23 13:44:09 GMT 2024

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

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

Back to the top