Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF-to-XSD Model Transformation
EMF-to-XSD Model Transformation [message #1008036] Fri, 08 February 2013 15:43 Go to next message
Florian W. is currently offline Florian W.Friend
Messages: 15
Registered: January 2013
Junior Member
Hi,

I have already posted my problem in the GMF forum (click here to see the post). The main problem seems to be that EMF creates an empty name feature when creating the model from a XML schema. Can anyone tell my if it is correct that the name feature of DocumentRoot is empty? Does anybody have an idea what I could do?

Florian

[Updated on: Thu, 04 April 2013 14:22]

Report message to a moderator

Re: Does EMF create invalid models from XSD? [message #1008045 is a reply to message #1008036] Fri, 08 February 2013 16:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Florian,

Comments below.

On 08/02/2013 4:43 PM, Florian W. wrote:
> Hi,
>
> I have already posted my problem in the GMF forum (click
> http://www.eclipse.org/forums/index.php/t/452255/ to see the post).
> The main problem seems to be that EMF creates an empty name feature
> when creating the model from a XML schema.
The XML name for a document root is definitely empty; but such a name
shouldn't be used anywhere given that it doesn't corresponding to any
thing in XML schema with name. The name of the EClassifier isn't empty
though... It's important that the name be the empty string because
org.eclipse.emf.ecore.util.BasicExtendedMetaData.isDocumentRoot(EClass)
recognizes a document root that way:

public boolean isDocumentRoot(EClass eClass)
{
return "".equals(getName(eClass));
}

If you change that, you're likely to have issues deserializing instances
that conform to your schema. It looks like you already discovered that.

> Can anyone tell my if it is correct that the name feature of
> DocumentRoot is empty?
Yes, and it's important that it's the empty string.
> Does anybody have an idea what I could do?
It's not clear from the other thread why this is a problem. Where are
you using the XML name? Wherever that it is, you likely need to treat
the document root special because it acts like an place holder for the
root element of your XML...
>
> Florian


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Does EMF create invalid models from XSD? [message #1008051 is a reply to message #1008045] Fri, 08 February 2013 16:19 Go to previous message
Florian W. is currently offline Florian W.Friend
Messages: 15
Registered: January 2013
Junior Member
Hi Ed,

thanks for making things clear! In fact, I do not use the name attribute anywhere. I just found out that GMF does not throw an error if the name attribute of the DocumentRoot is not empty. However, this does not really solve my problems with GMF. When the name attribute is empty the code responsible for the error message isn't even executed. Now this behavior is clear to me - the code is only called for the DocumentRoot but as soon as I change the name attribute the DocumentRoot is no longer recognized by GMF. Thus, the error message I get when using GMF is no problem related to EMF und must be somewhere in the code implementing the DocumentRoot.

Florian

[Updated on: Fri, 08 February 2013 16:21]

Report message to a moderator

Previous Topic:Hibernate timeout on connection
Next Topic:[EMF] ClassCastException: $Proxy cannot be cast...
Goto Forum:
  


Current Time: Fri Apr 19 23:18:23 GMT 2024

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

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

Back to the top