Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Controlling XML serialization
Controlling XML serialization [message #425158] Mon, 17 November 2008 19:42 Go to next message
Ron Bermejo is currently offline Ron BermejoFriend
Messages: 30
Registered: July 2009
Member
Hi guys.

I was wondering if this was possible: I have an EMF model that looks like
this

Class A contains 0..* Class B (via feature "b")

The default XML serialization would look like this:
<A>
<b>...</b>
<b>...</b>
</A>

Is there any way to control the serialization (eg, via EAnnotations on
"b"?) such that it would look like this:

<A>
<bs>
<b>...</b>
<b>...</b>
</bs>
</A>

Essentially I want the 'b' feature to be grouped into a <bs>...</bs> in
the serialized form, without having to create a new feature 'bs' in A.

Thanks for any help!

Best regards,
Ron
Re: Controlling XML serialization [message #425172 is a reply to message #425158] Tue, 18 November 2008 06:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020100030504050308000804
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Ron,

The patches in 201662
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=201662> do what you're
describing.


Ron Bermejo wrote:
> Hi guys.
>
> I was wondering if this was possible: I have an EMF model that looks
> like this
>
> Class A contains 0..* Class B (via feature "b")
>
> The default XML serialization would look like this:
> <A>
> <b>...</b>
> <b>...</b>
> </A>
>
> Is there any way to control the serialization (eg, via EAnnotations on
> "b"?) such that it would look like this:
>
> <A>
> <bs>
> <b>...</b>
> <b>...</b>
> </bs>
> </A>
>
> Essentially I want the 'b' feature to be grouped into a <bs>...</bs>
> in the serialized form, without having to create a new feature 'bs' in A.
>
> Thanks for any help!
>
> Best regards,
> Ron
>

--------------020100030504050308000804
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">
</head>
<body bgcolor="#ffffff" text="#000000">
Ron,<br>
<br>
The patches in <a name="b201662"
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=201662">201662</a>
do what you're describing.<br>
<br>
<br>
Ron Bermejo wrote:
<blockquote
cite="mid:506592154666285514dad96b393440a6$1@www.eclipse.org"
type="cite">Hi guys.
<br>
<br>
I was wondering if this was possible: I have an EMF model that looks
like this
<br>
<br>
Class A contains 0..* Class B (via feature "b")
<br>
<br>
The default XML serialization would look like this:
<br>
&lt;A&gt;
<br>
&lt;b&gt;...&lt;/b&gt;
<br>
&lt;b&gt;...&lt;/b&gt;
<br>
&lt;/A&gt;
<br>
<br>
Is there any way to control the serialization (eg, via EAnnotations on
"b"?) such that it would look like this:
<br>
<br>
&lt;A&gt;
<br>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Controlling XML serialization [message #425288 is a reply to message #425172] Fri, 21 November 2008 18:17 Go to previous message
Ron Bermejo is currently offline Ron BermejoFriend
Messages: 30
Registered: July 2009
Member
Thanks, Ed!

This is exactly what I was looking for. Well, sort of, since I'm not using
XSD but manually editing the model. I'll try the XSD path first and see if
I can make a similar ecore.

Ron

Ed Merks wrote:

> Ron,

> The patches in 201662
> <https://bugs.eclipse.org/bugs/show_bug.cgi?id=201662> do what you're
> describing.


> Ron Bermejo wrote:
>> Hi guys.
>>
>> I was wondering if this was possible: I have an EMF model that looks
>> like this
>>
>> Class A contains 0..* Class B (via feature "b")
>>
>> The default XML serialization would look like this:
>> <A>
>> <b>...</b>
>> <b>...</b>
>> </A>
>>
>> Is there any way to control the serialization (eg, via EAnnotations on
>> "b"?) such that it would look like this:
>>
>> <A>
>> <bs>
>> <b>...</b>
>> <b>...</b>
>> </bs>
>> </A>
>>
>> Essentially I want the 'b' feature to be grouped into a <bs>...</bs>
>> in the serialized form, without having to create a new feature 'bs' in A.
>>
>> Thanks for any help!
>>
>> Best regards,
>> Ron
>>
Previous Topic:Auto unload - memory management
Next Topic:Iteration of non-containment references
Goto Forum:
  


Current Time: Fri Mar 29 06:30:36 GMT 2024

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

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

Back to the top