Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Problem with XML modeling: Class 'name' is not found or is abstract.
icon5.gif  Problem with XML modeling: Class 'name' is not found or is abstract. [message #1153545] Thu, 24 October 2013 17:37 Go to next message
Lefteris Skoutaris is currently offline Lefteris SkoutarisFriend
Messages: 24
Registered: March 2013
Junior Member
Dear all,
I am new to eclipse and I am trying to model with EMF an XML instance file.

I have created a very very simple xml file and schema just for testing purposes and solving this problem. The xml instance below is valid against the schema. Therefore, there must be some kind of an issue with EMF?

XML instance:
<?xml version="1.0" encoding="utf-8"?>
<cdm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:/C:/Users/eleftherios.skoutari/workspace-indigo/XSDs/cdm_xml_bluebook_schema.xsd" id="CCSDS_CDM_VERS" version="1.0">

<header>
<CREATION_DATE>2010-03-12T22:31:12.000</CREATION_DATE>
</header>
</cdm>


Schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="cdm">
<xs:complexType>
<xs:sequence>

<xs:element name="header">
<xs:complexType>
<xs:sequence>
<xs:element name="CREATION_DATE" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>

I have created a project,loaded the schema and generated the code. When I run the instance in an editor I get the following error:
org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'cdm' is not found or is abstract.

Any ideas why this is the case? Thank you in advance for any help you can provide!

[Updated on: Thu, 24 October 2013 17:39]

Report message to a moderator

Re: Problem with XML modeling: Class 'name' is not found or is abstract. [message #1154410 is a reply to message #1153545] Fri, 25 October 2013 07:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30353
Registered: July 2009
Senior Member
Lefteris,

What file extension are you using? Note that if you use an extension
such as "xml" that is widely used by others, you'll need to rely on
content types recognition. You can do that by setting the GenPackage's
Content Type Identifier to something like org.example.myContent.


On 24/10/2013 7:37 PM, Lefteris Skoutaris wrote:
> Dear all,
> I am new to eclipse and I am trying to model with EMF an XML
> instance file.
>
> I have created a very very simple xml file and schema just for testing
> purposes and solving this problem. The xml instance below is valid
> against the schema. Therefore, there must be some kind of an issue
> with EMF?
>
> XML instance:
> <?xml version="1.0" encoding="utf-8"?>
> <cdm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="file:/C:/Users/eleftherios.skoutari/workspace-indigo/XSDs/cdm_xml_bluebook_schema.xsd"
> id="CCSDS_CDM_VERS" version="1.0">
>
> <header>
> <CREATION_DATE>2010-03-12T22:31:12.000</CREATION_DATE>
> </header>
> </cdm>
>
> Schema:
> <?xml version="1.0" encoding="utf-8"?>
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
> <xs:element name="cdm">
> <xs:complexType>
> <xs:sequence>
>
> <xs:element name="header">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="CREATION_DATE" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> </xs:sequence>
> <xs:attribute name="id" type="xs:string" use="required"/>
> <xs:attribute name="version" type="xs:string" use="required"/>
> </xs:complexType>
> </xs:element> </xs:schema>
> I have created a project,loaded the schema and generated the code.
> When I run the instance in an editor I get the following error:
> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'cdm' is not
> found or is abstract.
>
> Any ideas why this is the case? Thank you in advance for any help you
> can provide!
Re: Problem with XML modeling: Class 'name' is not found or is abstract. [message #1159166 is a reply to message #1154410] Mon, 28 October 2013 10:40 Go to previous messageGo to next message
Lefteris Skoutaris is currently offline Lefteris SkoutarisFriend
Messages: 24
Registered: March 2013
Junior Member
Hi Ed,

I have managed to parse the XML instance with a non-XML extension, but I would like to learn how this content type recognition works.

The package org.eclipse.core.runtime.content and the plugin.xml includes the following content types.

<plugin>
<extension-point id="contentTypes" name="%contentTypesName" schema="schema/contentTypes.exsd"/>

<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type id="org.eclipse.core.runtime.text" name="%textContentTypeName"
priority="high"
file-extensions="txt">
<describer class="org.eclipse.core.internal.content.TextContentDescriber"/>
<property name="org.eclipse.core.runtime.bom"/>
<property name="org.eclipse.core.runtime.charset"/>
</content-type>
<content-type id="org.eclipse.core.runtime.xml" name="%xmlContentTypeName"
base-type="org.eclipse.core.runtime.text"
priority="high"
file-extensions="xml">
<property name="org.eclipse.core.runtime.charset" default="UTF-8"/>
<describer class="org.eclipse.core.runtime.content.XMLContentDescriber"/>
</content-type>

<!-- a placeholder for setups where JDT's official type is not available -->
<content-type id="org.eclipse.core.runtime.properties" name="%propertiesContentTypeName"
base-type="org.eclipse.core.runtime.text"
alias-for="org.eclipse.jdt.core.javaProperties"
file-extensions="properties">
<property name="org.eclipse.core.runtime.charset" default="ISO-8859-1"/>
</content-type>
</extension>
</plugin>


Do I have to somehow associate the instance file.xml with the project's plugins? If yes, how do I correlate the two? By setting at the ID the same namespace included in the file?I need to understand this concept first before making any changes.
Re: Problem with XML modeling: Class 'name' is not found or is abstract. [message #1159185 is a reply to message #1159166] Mon, 28 October 2013 10:53 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30353
Registered: July 2009
Senior Member
Lefteris,

Have you regenerated to see what EMF produces for you? Then you have
something that works and you can spend time figuring out how and why.

On 28/10/2013 11:40 AM, Lefteris Skoutaris wrote:
> Hi Ed,
>
> I have managed to parse the XML instance with a non-XML extension, but
> I would like to learn how this content type recognition works.
>
> The package org.eclipse.core.runtime.content and the plugin.xml
> includes the following content types.
>
> <plugin>
> <extension-point id="contentTypes" name="%contentTypesName"
> schema="schema/contentTypes.exsd"/>
> <extension point="org.eclipse.core.contenttype.contentTypes">
> <content-type id="org.eclipse.core.runtime.text"
> name="%textContentTypeName" priority="high"
> file-extensions="txt">
> <describer
> class="org.eclipse.core.internal.content.TextContentDescriber"/>
> <property name="org.eclipse.core.runtime.bom"/>
> <property name="org.eclipse.core.runtime.charset"/>
> </content-type>
> <content-type id="org.eclipse.core.runtime.xml"
> name="%xmlContentTypeName"
> base-type="org.eclipse.core.runtime.text"
> priority="high"
> file-extensions="xml">
> <property name="org.eclipse.core.runtime.charset"
> default="UTF-8"/>
> <describer
> class="org.eclipse.core.runtime.content.XMLContentDescriber"/>
> </content-type>
> <!-- a placeholder for setups where JDT's official type is not
> available -->
> <content-type id="org.eclipse.core.runtime.properties"
> name="%propertiesContentTypeName"
> base-type="org.eclipse.core.runtime.text"
> alias-for="org.eclipse.jdt.core.javaProperties"
> file-extensions="properties">
> <property name="org.eclipse.core.runtime.charset"
> default="ISO-8859-1"/>
> </content-type>
> </extension> </plugin>
>
>
> Do I have to somehow associate the instance file.xml with the
> project's plugins? If yes, how do I correlate the two? By setting at
> the ID the same namespace included in the file?I need to understand
> this concept first before making any changes.
>
Previous Topic:[CDO]Load an XMIResource Exception!!!
Next Topic:org.eclipse.emf plugins not loaded
Goto Forum:
  


Current Time: Tue Aug 20 15:55:42 GMT 2019

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

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

Back to the top