Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XSD and EList
XSD and EList [message #425433] Wed, 26 November 2008 09:50 Go to next message
Florian Hess is currently offline Florian HessFriend
Messages: 1
Registered: July 2009
Junior Member
Hello together,

i just started to develop applications in EMF and stuck already in my
first problem or lets say misunderstanding of the concept! I generated a
XML Schema file and generate the emf model..everything works fine. The
problem is about this piece of the schema document.

...
<element name="source" type="net:netobject" minOccurs="1"
maxOccurs="unbounded" />
<element name="dest" type="net:netobject" minOccurs="1"
maxOccurs="unbounded" />
<element name="service" type="ser:serviceobject" minOccurs="1"
maxOccurs="unbounded" />
...

With the schemas i'd like to design a Ruleset of a Firewall. I used the
type as shown in the figure above in this way because of not instantiate a
for example a netobject each time if it occurs in a rule. Instead i'd like
to use an existing object which has the same values and represent the same
host, range or whatever.

EMF generates the following attributes in the class of the schema file:

protected EList<Netobject> source;
protected EList<Netobject> dest;
protected EList<Serviceobject> service;

So far so good! After creating netobject and adding them to the list i'd
like to create a new rule but here is the problem..using an iterator to go
through the list I get the object but with no attributes!!! The attributes
of the added object are gone..and references to null. I need first of all
the entire attributes to check before creating an netobject if it exists
or not and each Rule need the attributes to.

Can I determine how deep or in which way the values will be stored of an
object or do I have to implement on my own a list which deals with the
objects?

I hope you can get what I want and say thanks for all ideas, comments or
answers in advance.
Florian
Re: XSD and EList [message #425446 is a reply to message #425433] Wed, 26 November 2008 13:48 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Florian,

Comments below.


Florian Hess wrote:
> Hello together,
>
> i just started to develop applications in EMF and stuck already in my
> first problem or lets say misunderstanding of the concept! I generated
> a XML Schema file and generate the emf model..everything works fine.
> The problem is about this piece of the schema document.
>
> ..
> <element name="source" type="net:netobject" minOccurs="1"
> maxOccurs="unbounded" />
> <element name="dest" type="net:netobject" minOccurs="1"
> maxOccurs="unbounded" />
> <element name="service" type="ser:serviceobject" minOccurs="1"
> maxOccurs="unbounded" />
> ..
>
> With the schemas i'd like to design a Ruleset of a Firewall. I used
> the type as shown in the figure above in this way because of not
> instantiate a for example a netobject each time if it occurs in a
> rule. Instead i'd like to use an existing object which has the same
> values and represent the same host, range or whatever.
> EMF generates the following attributes in the class of the schema file:
>
> protected EList<Netobject> source;
> protected EList<Netobject> dest;
> protected EList<Serviceobject> service;
>
> So far so good!
But these are all containment references which means the object's the
reference cannot be contained anywhere else (just like is the case for DOM).
> After creating netobject and adding them to the list i'd like to
> create a new rule but here is the problem..using an iterator to go
> through the list I get the object but with no attributes!!! The
> attributes of the added object are gone..and references to null. I
> need first of all the entire attributes to check before creating an
> netobject if it exists or not and each Rule need the attributes to.
I'm not quite sure I follow....
>
> Can I determine how deep or in which way the values will be stored of
> an object or do I have to implement on my own a list which deals with
> the objects?
Do you know what I mean when I talk about containment references and
non-containment (or cross) references?
> I hope you can get what I want and say thanks for all ideas, comments
> or answers in advance. Florian
If you look at the Library schema tutorial, you'll see that while
Library contains Books and Writer, each Book and each Writer refer to
each other via non-containment references, i.e, using IDREF or anyURI in
the XML Schema. It sound like you probably need to understand well the
distinction between containment and non-containment and the Library
example is a good simple example that should help.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Second CDOResource with name=null
Next Topic:Notifications Problem
Goto Forum:
  


Current Time: Sat Apr 20 00:50:42 GMT 2024

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

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

Back to the top