Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » suppress DocumentRoot serialization
suppress DocumentRoot serialization [message #386294] Wed, 30 June 2004 18:06 Go to next message
Eclipse UserFriend
Originally posted by: nospamplease.dev.null

Hi,

I'm pretty sure I've read every thread and the release notes on the
DocumentRoot object. I think I understand why it needs to be in the object
model, but I don't get why it needs to be in the serialized form of the
resource.

Is there an easy way to read/write a resource that does not include the
special DocumentRoot element, allowing my editor to be compatible with other
applications that share the same public schema?

The only option I can think of is to create a subclass of XMIResourceImpl,
but that has other consequences as well.

Brian
Re: suppress DocumentRoot serialization [message #386310 is a reply to message #386294] Thu, 01 July 2004 21:14 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Brian DeCamp wrote:

> I'm pretty sure I've read every thread and the release notes on the
> DocumentRoot object. I think I understand why it needs to be in the object
> model, but I don't get why it needs to be in the serialized form of the
> resource.

Hi Brian,

It definitely should not show up in the serialized form of the resource. If
it does, it's not just introducing unecessary noise, it's actually
preventing the document from conforming to the schema that you created the
model from.

When you generate your model, you should be getting a simple resource and
resource factory implementation in the util package. It's important that
you use these, instead of the default XMI resource/resource factory, for
schema-conforming serialization, including supression of the DocumentRoot.

If you're running inside Eclipse, the plug-in manifest file should
automatically register the generated resource factory against the default
extension for your model. Otherwise, you'll need to make an appropriate
registration in your resource set's resource factory registry
(myResourceSet.getResourceFactoryRegistry()) or in the global registry
(Resource.Factory.Registry.INSTANCE). You can register the resource factory
against a given URI scheme (protocol), file extension, or as the default.

Cheers,
Dave
Re: suppress DocumentRoot serialization [message #386319 is a reply to message #386310] Fri, 02 July 2004 17:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nospamplease.dev.null

Thanks Dave. I thought I was losing my mind, but I'm better now.

The problems was with the plugin.xml
extension@[point="org.eclipse.emf.core.extension_parser"]
I changed the parser@[type] to equal the extension for my file-type.

I had changed the file suffix in other locations, but not this one, which is
what caused the problem in the first place.

Great stuff!

Brian

"Dave Steinberg" <davidms@ca.ibm.com> wrote in message
news:cc1upr$dqi$1@eclipse.org...
> Brian DeCamp wrote:
>
> > I'm pretty sure I've read every thread and the release notes on the
> > DocumentRoot object. I think I understand why it needs to be in the
object
> > model, but I don't get why it needs to be in the serialized form of the
> > resource.
>
> Hi Brian,
>
> It definitely should not show up in the serialized form of the resource.
If
> it does, it's not just introducing unecessary noise, it's actually
> preventing the document from conforming to the schema that you created the
> model from.
>
> When you generate your model, you should be getting a simple resource and
> resource factory implementation in the util package. It's important that
> you use these, instead of the default XMI resource/resource factory, for
> schema-conforming serialization, including supression of the DocumentRoot.
>
> If you're running inside Eclipse, the plug-in manifest file should
> automatically register the generated resource factory against the default
> extension for your model. Otherwise, you'll need to make an appropriate
> registration in your resource set's resource factory registry
> (myResourceSet.getResourceFactoryRegistry()) or in the global registry
> (Resource.Factory.Registry.INSTANCE). You can register the resource
factory
> against a given URI scheme (protocol), file extension, or as the default.
>
> Cheers,
> Dave
>
Re: suppress DocumentRoot serialization [message #391516 is a reply to message #386310] Fri, 04 March 2005 14:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: emmerich.salt.ac.za

There is brief mention of suppressing the DocumentRoot in this thread.
Could somebody go into a little more detail as to how I would go about
doing this?

Thanks
Roy

Dave Steinberg wrote:
> Brian DeCamp wrote:
>
>> I'm pretty sure I've read every thread and the release notes on the
>> DocumentRoot object. I think I understand why it needs to be in the
>> object
>> model, but I don't get why it needs to be in the serialized form of the
>> resource.
>
>
> Hi Brian,
>
> It definitely should not show up in the serialized form of the
> resource. If it does, it's not just introducing unecessary noise, it's
> actually preventing the document from conforming to the schema that you
> created the model from.
>
> When you generate your model, you should be getting a simple resource
> and resource factory implementation in the util package. It's important
> that you use these, instead of the default XMI resource/resource
> factory, for schema-conforming serialization, including supression of
> the DocumentRoot.
>
> If you're running inside Eclipse, the plug-in manifest file should
> automatically register the generated resource factory against the
> default extension for your model. Otherwise, you'll need to make an
> appropriate registration in your resource set's resource factory
> registry (myResourceSet.getResourceFactoryRegistry()) or in the global
> registry (Resource.Factory.Registry.INSTANCE). You can register the
> resource factory against a given URI scheme (protocol), file extension,
> or as the default.
>
> Cheers,
> Dave
>


--
Roy Emmerich
SALT - Southern African Large Telescope
+27 (0)21 460 6296 (direct)
+27 (0)21 460 6280 (switchboard)
+27 (0)21 447 1312 (fax)
emmerich(at)salt.ac.za (email)
www.salt.ac.za (web)
Re: suppress DocumentRoot serialization [message #391546 is a reply to message #391516] Sat, 05 March 2005 23:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Roy,

If you save using the resource created by the generated
XyzResourceFactoryImpl, i.e., using an XMLResourceImpl with the
XMLResource.EXTENDED_META_DATA option, there should be no explicit
DocumentRoot in the serialization. If you do see one, you aren't using
the right type of resource or aren't using the right options.


Roy Emmerich wrote:

> There is brief mention of suppressing the DocumentRoot in this thread.
> Could somebody go into a little more detail as to how I would go about
> doing this?
>
> Thanks
> Roy
>
> Dave Steinberg wrote:
>
>> Brian DeCamp wrote:
>>
>>> I'm pretty sure I've read every thread and the release notes on the
>>> DocumentRoot object. I think I understand why it needs to be in the
>>> object
>>> model, but I don't get why it needs to be in the serialized form of the
>>> resource.
>>
>>
>>
>> Hi Brian,
>>
>> It definitely should not show up in the serialized form of the
>> resource. If it does, it's not just introducing unecessary noise,
>> it's actually preventing the document from conforming to the schema
>> that you created the model from.
>>
>> When you generate your model, you should be getting a simple resource
>> and resource factory implementation in the util package. It's
>> important that you use these, instead of the default XMI
>> resource/resource factory, for schema-conforming serialization,
>> including supression of the DocumentRoot.
>>
>> If you're running inside Eclipse, the plug-in manifest file should
>> automatically register the generated resource factory against the
>> default extension for your model. Otherwise, you'll need to make an
>> appropriate registration in your resource set's resource factory
>> registry (myResourceSet.getResourceFactoryRegistry()) or in the
>> global registry (Resource.Factory.Registry.INSTANCE). You can
>> register the resource factory against a given URI scheme (protocol),
>> file extension, or as the default.
>>
>> Cheers,
>> Dave
>>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: suppress DocumentRoot in Editor [message #391564 is a reply to message #391546] Mon, 07 March 2005 10:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: emmerich.salt.ac.za

Sorry Ed, my description wasn't clear enough. I'm not getting the
DocumentRoot in the serialization. What I want to do is suppress it in
the generated editor.

Thanks
Roy

Ed Merks wrote:
> Roy,
>
> If you save using the resource created by the generated
> XyzResourceFactoryImpl, i.e., using an XMLResourceImpl with the
> XMLResource.EXTENDED_META_DATA option, there should be no explicit
> DocumentRoot in the serialization. If you do see one, you aren't using
> the right type of resource or aren't using the right options.
>
>
> Roy Emmerich wrote:
>
>> There is brief mention of suppressing the DocumentRoot in this thread.
>> Could somebody go into a little more detail as to how I would go about
>> doing this?
>>
>> Thanks
>> Roy
>>
>> Dave Steinberg wrote:
>>
>>> Brian DeCamp wrote:
>>>
>>>> I'm pretty sure I've read every thread and the release notes on the
>>>> DocumentRoot object. I think I understand why it needs to be in the
>>>> object
>>>> model, but I don't get why it needs to be in the serialized form of the
>>>> resource.
>>>
>>>
>>>
>>>
>>> Hi Brian,
>>>
>>> It definitely should not show up in the serialized form of the
>>> resource. If it does, it's not just introducing unecessary noise,
>>> it's actually preventing the document from conforming to the schema
>>> that you created the model from.
>>>
>>> When you generate your model, you should be getting a simple resource
>>> and resource factory implementation in the util package. It's
>>> important that you use these, instead of the default XMI
>>> resource/resource factory, for schema-conforming serialization,
>>> including supression of the DocumentRoot.
>>>
>>> If you're running inside Eclipse, the plug-in manifest file should
>>> automatically register the generated resource factory against the
>>> default extension for your model. Otherwise, you'll need to make an
>>> appropriate registration in your resource set's resource factory
>>> registry (myResourceSet.getResourceFactoryRegistry()) or in the
>>> global registry (Resource.Factory.Registry.INSTANCE). You can
>>> register the resource factory against a given URI scheme (protocol),
>>> file extension, or as the default.
>>>
>>> Cheers,
>>> Dave
>>>
>>
>>


--
Roy Emmerich
SALT - Southern African Large Telescope
+27 (0)21 460 6296 (direct)
+27 (0)21 460 6280 (switchboard)
+27 (0)21 447 1312 (fax)
emmerich(at)salt.ac.za (email)
www.salt.ac.za (web)
Re: suppress DocumentRoot in Editor [message #391583 is a reply to message #391564] Tue, 08 March 2005 13:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Roy,

Since the DocumentRoot is shown as a child of the Resource, you'd need a
specialized ResourceItemProvider that skips over that object.


Roy Emmerich wrote:

> Sorry Ed, my description wasn't clear enough. I'm not getting the
> DocumentRoot in the serialization. What I want to do is suppress it in
> the generated editor.
>
> Thanks
> Roy
>
> Ed Merks wrote:
>
>> Roy,
>>
>> If you save using the resource created by the generated
>> XyzResourceFactoryImpl, i.e., using an XMLResourceImpl with the
>> XMLResource.EXTENDED_META_DATA option, there should be no explicit
>> DocumentRoot in the serialization. If you do see one, you aren't
>> using the right type of resource or aren't using the right options.
>>
>>
>> Roy Emmerich wrote:
>>
>>> There is brief mention of suppressing the DocumentRoot in this
>>> thread. Could somebody go into a little more detail as to how I
>>> would go about doing this?
>>>
>>> Thanks
>>> Roy
>>>
>>> Dave Steinberg wrote:
>>>
>>>> Brian DeCamp wrote:
>>>>
>>>>> I'm pretty sure I've read every thread and the release notes on the
>>>>> DocumentRoot object. I think I understand why it needs to be in
>>>>> the object
>>>>> model, but I don't get why it needs to be in the serialized form
>>>>> of the
>>>>> resource.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Hi Brian,
>>>>
>>>> It definitely should not show up in the serialized form of the
>>>> resource. If it does, it's not just introducing unecessary noise,
>>>> it's actually preventing the document from conforming to the schema
>>>> that you created the model from.
>>>>
>>>> When you generate your model, you should be getting a simple
>>>> resource and resource factory implementation in the util package.
>>>> It's important that you use these, instead of the default XMI
>>>> resource/resource factory, for schema-conforming serialization,
>>>> including supression of the DocumentRoot.
>>>>
>>>> If you're running inside Eclipse, the plug-in manifest file should
>>>> automatically register the generated resource factory against the
>>>> default extension for your model. Otherwise, you'll need to make
>>>> an appropriate registration in your resource set's resource factory
>>>> registry (myResourceSet.getResourceFactoryRegistry()) or in the
>>>> global registry (Resource.Factory.Registry.INSTANCE). You can
>>>> register the resource factory against a given URI scheme
>>>> (protocol), file extension, or as the default.
>>>>
>>>> Cheers,
>>>> Dave
>>>>
>>>
>>>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: suppress DocumentRoot in Editor [message #392205 is a reply to message #391583] Sun, 10 April 2005 23:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mirdous.seznam.cz

Ed Merks wrote:
> Roy,
>
> Since the DocumentRoot is shown as a child of the Resource, you'd need a
> specialized ResourceItemProvider that skips over that object.
>
>
> Roy Emmerich wrote:
>
>> Sorry Ed, my description wasn't clear enough. I'm not getting the
>> DocumentRoot in the serialization. What I want to do is suppress it in
>> the generated editor.
>>
>> Thanks
>> Roy
>>
>> Ed Merks wrote:
>>
>>> Roy,
>>>
>>> If you save using the resource created by the generated
>>> XyzResourceFactoryImpl, i.e., using an XMLResourceImpl with the
>>> XMLResource.EXTENDED_META_DATA option, there should be no explicit
>>> DocumentRoot in the serialization. If you do see one, you aren't
>>> using the right type of resource or aren't using the right options.
>>>
>>>
>>> Roy Emmerich wrote:
>>>
>>>> There is brief mention of suppressing the DocumentRoot in this
>>>> thread. Could somebody go into a little more detail as to how I
>>>> would go about doing this?
>>>>
>>>> Thanks
>>>> Roy
>>>>
>>>> Dave Steinberg wrote:
>>>>
>>>>> Brian DeCamp wrote:
>>>>>
>>>>>> I'm pretty sure I've read every thread and the release notes on the
>>>>>> DocumentRoot object. I think I understand why it needs to be in
>>>>>> the object
>>>>>> model, but I don't get why it needs to be in the serialized form
>>>>>> of the
>>>>>> resource.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Hi Brian,
>>>>>
>>>>> It definitely should not show up in the serialized form of the
>>>>> resource. If it does, it's not just introducing unecessary noise,
>>>>> it's actually preventing the document from conforming to the schema
>>>>> that you created the model from.
>>>>>
>>>>> When you generate your model, you should be getting a simple
>>>>> resource and resource factory implementation in the util package.
>>>>> It's important that you use these, instead of the default XMI
>>>>> resource/resource factory, for schema-conforming serialization,
>>>>> including supression of the DocumentRoot.
>>>>>
>>>>> If you're running inside Eclipse, the plug-in manifest file should
>>>>> automatically register the generated resource factory against the
>>>>> default extension for your model. Otherwise, you'll need to make
>>>>> an appropriate registration in your resource set's resource factory
>>>>> registry (myResourceSet.getResourceFactoryRegistry()) or in the
>>>>> global registry (Resource.Factory.Registry.INSTANCE). You can
>>>>> register the resource factory against a given URI scheme
>>>>> (protocol), file extension, or as the default.
>>>>>
>>>>> Cheers,
>>>>> Dave
>>>>>
>>>>
>>>>
>>
>>
Roy,

I have same problem to skip DocumentRoot item, but I think it might work
as editor's TreeViewer page generated by EMF. When you select
Document root in outline view it shows only children of that item.
Can you provide any souce code how to skip that item? tnx


Mirdous
Re: suppress DocumentRoot serialization [message #392864 is a reply to message #391546] Mon, 16 May 2005 00:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mirdous.seznam.cz

I found out that DocumentRoot is serialized : when you generate model
from xml schema with package name let's say abc then EMF will register
AbcResourceFactoryImpl for type(extension) abc. When you change
extension (in property file) to anything that is different from abc e.g.
xml then you get DocumentRoot serialized. It have to be changed in
plugin.xml in EMF model in extension_parser as well.

Mirdous
> Roy,
>
> If you save using the resource created by the generated
> XyzResourceFactoryImpl, i.e., using an XMLResourceImpl with the
> XMLResource.EXTENDED_META_DATA option, there should be no explicit
> DocumentRoot in the serialization. If you do see one, you aren't using
> the right type of resource or aren't using the right options.
>
>
> Roy Emmerich wrote:
>
>> There is brief mention of suppressing the DocumentRoot in this thread.
>> Could somebody go into a little more detail as to how I would go about
>> doing this?
>>
>> Thanks
>> Roy
>>
>> Dave Steinberg wrote:
>>
>>> Brian DeCamp wrote:
>>>
>>>> I'm pretty sure I've read every thread and the release notes on the
>>>> DocumentRoot object. I think I understand why it needs to be in the
>>>> object
>>>> model, but I don't get why it needs to be in the serialized form of the
>>>> resource.
>>>
>>>
>>>
>>>
>>> Hi Brian,
>>>
>>> It definitely should not show up in the serialized form of the
>>> resource. If it does, it's not just introducing unecessary noise,
>>> it's actually preventing the document from conforming to the schema
>>> that you created the model from.
>>>
>>> When you generate your model, you should be getting a simple resource
>>> and resource factory implementation in the util package. It's
>>> important that you use these, instead of the default XMI
>>> resource/resource factory, for schema-conforming serialization,
>>> including supression of the DocumentRoot.
>>>
>>> If you're running inside Eclipse, the plug-in manifest file should
>>> automatically register the generated resource factory against the
>>> default extension for your model. Otherwise, you'll need to make an
>>> appropriate registration in your resource set's resource factory
>>> registry (myResourceSet.getResourceFactoryRegistry()) or in the
>>> global registry (Resource.Factory.Registry.INSTANCE). You can
>>> register the resource factory against a given URI scheme (protocol),
>>> file extension, or as the default.
>>>
>>> Cheers,
>>> Dave
>>>
>>
>>
Re: suppress DocumentRoot serialization [message #421182 is a reply to message #386310] Tue, 29 July 2008 19:38 Go to previous messageGo to next message
Gary Leask is currently offline Gary LeaskFriend
Messages: 28
Registered: July 2009
Junior Member
Dave Steinberg wrote:
> Brian DeCamp wrote:
>
>> I'm pretty sure I've read every thread and the release notes on the
>> DocumentRoot object. I think I understand why it needs to be in the
>> object
>> model, but I don't get why it needs to be in the serialized form of the
>> resource.
>
> Hi Brian,
>
> It definitely should not show up in the serialized form of the
> resource. If it does, it's not just introducing unecessary noise, it's
> actually preventing the document from conforming to the schema that you
> created the model from.
>
> When you generate your model, you should be getting a simple resource
> and resource factory implementation in the util package. It's important
> that you use these, instead of the default XMI resource/resource
> factory, for schema-conforming serialization, including supression of
> the DocumentRoot.
>
> If you're running inside Eclipse, the plug-in manifest file should
> automatically register the generated resource factory against the
> default extension for your model. Otherwise, you'll need to make an
> appropriate registration in your resource set's resource factory
> registry (myResourceSet.getResourceFactoryRegistry()) or in the global
> registry (Resource.Factory.Registry.INSTANCE). You can register the
> resource factory against a given URI scheme (protocol), file extension,
> or as the default.
>
> Cheers,
> Dave
>

Dave

At what point in the editor life cycle do you register the new file
extension with the Resource Factory. Do you do it when you save the
document or before you create the editor.

Gary
Re: suppress DocumentRoot serialization [message #421184 is a reply to message #421182] Tue, 29 July 2008 19:47 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Gary Leask wrote:
>
> At what point in the editor life cycle do you register the new file
> extension with the Resource Factory. Do you do it when you save the
> document or before you create the editor.

Hi Gary,

It must be before you create the resource, which probably means before
you create the editor. The fact that you're talking about editors
suggests that you're running in an Eclipse workbench, which means that
the plugin.xml for your model plug-in should contain an extension that
does the appropriate registration right when Eclipse starts up.

Cheers,
Dave
Previous Topic:Resource from the EObject is empty after unload and load.
Next Topic:ECoreValidator generates bad value diagnostics
Goto Forum:
  


Current Time: Fri Apr 26 23:57:56 GMT 2024

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

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

Back to the top