Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Preserving XML comments during serialization and deserialization of XML document
Preserving XML comments during serialization and deserialization of XML document [message #416386] Tue, 29 January 2008 22:41 Go to next message
Stefan Baramov is currently offline Stefan BaramovFriend
Messages: 33
Registered: July 2009
Member
I am working on a editor of a GUI meta data described as an XML
document. The XML Schema is well defined and I had no problem generating
the ecore model from the XML schema. My editor has two pages: a
graphical presentation page and source code page. The graphical
presentation page is a tree structure and the source page is rendered by
the StructuredTextEditor of the Web Tools Project. The user is suppose
to be able to switch between XML source code and graphical presentation
doing editing in both. The problem is if I use EMF to serialize or
deserialize the XML text how do I preserve XML comments.

I found a posting
http://dev.eclipse.org/mhonarc/newsLists/news.eclipse.tools. emf/msg26322.html
suggesting to convert all complex types to mixed content. Unfortunately,
this is not an option for this project.

An article at
http://www.eclipse.org/articles/Article-WTP-Persisting-EMF/p ersisting.html
explains how to use the translator framework developed by the WTP folks.
However this framework is not documented and it is internal. So I cannot
really use it.

The only solution I see is to fork the WTP translation framework, and
develop something similar but simpler since I do not to maintain several
different version (not yet) of the schema files.

I would appreciate any suggests hints or something.

Thanks
Stefan Baramov
Re: Preserving XML comments during serialization and deserialization of XML document [message #416389 is a reply to message #416386] Tue, 29 January 2008 23:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Stefan,

Comments below.


Stefan Baramov wrote:
> I am working on a editor of a GUI meta data described as an XML
> document. The XML Schema is well defined and I had no problem
> generating the ecore model from the XML schema. My editor has two
> pages: a graphical presentation page and source code page. The
> graphical presentation page is a tree structure and the source page is
> rendered by the StructuredTextEditor of the Web Tools Project. The
> user is suppose to be able to switch between XML source code and
> graphical presentation doing editing in both. The problem is if I use
> EMF to serialize or deserialize the XML text how do I preserve XML
> comments.
Comments are effectively treated just like white space...
>
> I found a posting
> http://dev.eclipse.org/mhonarc/newsLists/news.eclipse.tools. emf/msg26322.html
> suggesting to convert all complex types to mixed content.
> Unfortunately, this is not an option for this project.
Yes, this is a pretty sucky approach since it messes up the APIs.
>
>
> An article at
> http://www.eclipse.org/articles/Article-WTP-Persisting-EMF/p ersisting.html
> explains how to use the translator framework developed by the WTP
> folks. However this framework is not documented and it is internal. So
> I cannot really use it.
So much internal stuff. :-(
>
> The only solution I see is to fork the WTP translation framework, and
> develop something similar but simpler since I do not to maintain
> several different version (not yet) of the schema files.

I suppose one could "associate" comments with the objects containing
them, but that would preserve their locations very well. I've never
explored how to do that.
>
> I would appreciate any suggests hints or something.
It's best to make the comments be part of the model's data so it's
properly available in the APIs rather than hide in the white space
between the real data...
>
> Thanks
> Stefan Baramov


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Preserving XML comments during serialization and deserialization of XML document [message #416409 is a reply to message #416389] Wed, 30 January 2008 15:59 Go to previous messageGo to next message
Stefan Baramov is currently offline Stefan BaramovFriend
Messages: 33
Registered: July 2009
Member
Ed Merks wrote:

> It's best to make the comments be part of the model's data so it's
> properly available in the APIs rather than hide in the white space
> between the real data...


So how can I make the comments part of the model? Do I modify the schema
or the *.genmodel file? What am I looking for ?


Thanks
Stefan
Re: Preserving XML comments during serialization and deserialization of XML document [message #416410 is a reply to message #416409] Wed, 30 January 2008 16:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Stefan,

I mean don't use XML comments. Use a normal feature in the model.


Stefan Baramov wrote:
> Ed Merks wrote:
>
>> It's best to make the comments be part of the model's data so it's
>> properly available in the APIs rather than hide in the white space
>> between the real data...
>
>
> So how can I make the comments part of the model? Do I modify the
> schema or the *.genmodel file? What am I looking for ?
>
>
> Thanks
> Stefan


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:New to EMF
Next Topic:Integrate with EMF code generation
Goto Forum:
  


Current Time: Thu Apr 25 01:21:35 GMT 2024

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

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

Back to the top