Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Element Ordering in EMF Serialization
Element Ordering in EMF Serialization [message #423973] Sun, 12 October 2008 12:45 Go to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
Hi,

Can anyone how we can control the element ordering in EMF Serialization,
e.g I have the following EMF model class,

├───Paragraph
│ ├───bullettedText (0..*)
│ ├───formattedText (0..*)
│ ├───heading (0..*)
│ ├───table (0..*)
│ └───text (0..*)


The following are some samples that shows what I want to do when
serialization happens

e.g - 1 : ExamplePara1(text,heading,formattedtext)

e.g. - 2 : ExamplePara2( text,heading,text,formattedtext,text)

e.g. - 3 :
ExamplePara3(text,heading,text,formattedtext,text,formattedt ext,bullettedtext,text)

What I am trying to achieve is that I want the any reference features to
occur in any order and also in mixed format.

Summary I don't what the element to be grouped within a parent as all
texts together , all paragraph together etc., i need to them to occur in
the order i create then in the Editor

Is there anyway we can do this in EMF Serialization. Any property we need
to set ? I tried with "ordered" property of the Class but in vain.

Thanks.

Kamesh
Re: Element Ordering in EMF Serialization [message #423991 is a reply to message #423973] Mon, 13 October 2008 16:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090808090400000604040304
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Kamesh,

Comments below.


Kamesh Sampath wrote:
> Hi,
>
> Can anyone how we can control the element ordering in EMF
> Serialization, e.g I have the following EMF model class,
>
> ├───Paragraph
> │ ├───bullettedText (0..*)
> │ ├───formattedText (0..*)
> │ ├───heading (0..*)
> │ ├───table (0..*)
> │ └───text (0..*)
>
>
> The following are some samples that shows what I want to do when
> serialization happens
>
> e.g - 1 : ExamplePara1(text,heading,formattedtext)
>
> e.g. - 2 : ExamplePara2( text,heading,text,formattedtext,text)
>
> e.g. - 3 :
> ExamplePara3(text,heading,text,formattedtext,text,formattedt ext,bullettedtext,text)
>
>
> What I am trying to achieve is that I want the any reference features
> to occur in any order and also in mixed format.
Try defining an <xsd:complexType> with mixed="true". This will produce
a model that supports what you show above. This will likely prove useful

Binding XML to Java
< http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>

>
> Summary I don't what the element to be grouped within a parent as all
> texts together , all paragraph together etc., i need to them to occur
> in the order i create then in the Editor
Be sure your complex type allow that mixed order.
>
> Is there anyway we can do this in EMF Serialization. Any property we
> need to set ? I tried with "ordered" property of the Class but in vain.
>
> Thanks.
>
> Kamesh
>
>
>
>
>

--------------090808090400000604040304
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Kamesh,<br>
<br>
Comments below.<br>
<br>
<br>
Kamesh Sampath wrote:
<blockquote
cite="mid:9ab5385cb829042ad73c2c9ad7aaa9f5$1@www.eclipse.org"
type="cite">Hi,
<br>
<br>
Can anyone how we can control the element ordering in EMF
Serialization, e.g I have the following EMF model class,
<br>
<br>
&amp;#9500;&amp;#9472;&amp;#9472;&amp;#9472; Paragraph
<br>
&amp;#9474;


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Element Ordering in EMF Serialization [message #423999 is a reply to message #423991] Tue, 14 October 2008 07:54 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
Hi Ed,

Thanks for the info . I have couple of questions there , am creating the
model from scratch using Ecore and not using the XSD. I tried to add the
annotation name->:mixed and kind->elementWildCard set to the correspoding
Eclass, I had also set the EXTENDED_META_DATA option to true to check it ,
but its still getting seralized as groups i.e all text appear first then
all paragraphs etc., though I added the text, paragraph, text when i
created the model .

Can you please let me know whether the options and metadata that i had set
is correct or I am missing something ?

Thanks.
Kamesh
Re: Element Ordering in EMF Serialization [message #424002 is a reply to message #423999] Tue, 14 October 2008 08:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Kamesh,

Comments below.

Kamesh Sampath wrote:
> Hi Ed,
>
> Thanks for the info . I have couple of questions there , am creating
> the model from scratch using Ecore and not using the XSD.
You'll have a much easier time if you write a small XSD, generate your
Ecore model from that, and then use that as the basis for what you're
trying. The odds of doing it correctly from scratch directly in Ecore
seem low.
> I tried to add the annotation name->:mixed and kind->elementWildCard
> set to the correspoding Eclass, I had also set the EXTENDED_META_DATA
> option to true to check it , but its still getting seralized as groups
> i.e all text appear first then all paragraphs etc., though I added the
> text, paragraph, text when i created the model .
Did you read the article to understand how mixed text works?
>
> Can you please let me know whether the options and metadata that i had
> set is correct or I am missing something ?
It sounds okay but likely you missed something... Best to create a
working schema-based example...
>
> Thanks.
> Kamesh
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[EMF] model instance exporting
Next Topic:Generating comments
Goto Forum:
  


Current Time: Thu Apr 25 08:36:07 GMT 2024

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

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

Back to the top