[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Preserving XML comments during serialization and deserialization of XML document

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/persisting.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