Skip to main content



      Home
Home » Modeling » EMF » EMF-to-XSD Model Transformation
EMF-to-XSD Model Transformation [message #1008036] Fri, 08 February 2013 10:43 Go to next message
Eclipse UserFriend
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 10:22] by Moderator

Re: Does EMF create invalid models from XSD? [message #1008045 is a reply to message #1008036] Fri, 08 February 2013 11:02 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Does EMF create invalid models from XSD? [message #1008051 is a reply to message #1008045] Fri, 08 February 2013 11:19 Go to previous message
Eclipse UserFriend
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 11:21] by Moderator

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


Current Time: Tue Jul 01 07:49:41 EDT 2025

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

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

Back to the top