Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7970233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:21:58+00:00 2026-06-04T07:21:58+00:00

I am using EMF with an XSD generated ecore. Now I’ve got the propblem,

  • 0

I am using EMF with an XSD generated ecore. Now I’ve got the propblem, that the generated file isn’t valid.
There are 2 Reasons:

  1. There is a DocumentRoot element inserted
  2. The attributes have the wrong capitalization.

The thing is: It is not a problem of the model, it is Propblem of the saving process (since in the EMF generated editor the output is correct.

First the correct result:

<?xml version="1.0" encoding="UTF-8"?>
<model:widgetspecification xmlns:model="http://test.com/model" Description="DESC" Name="NAME">
  <model:Property Name="PROP1"/>
  <model:Property Name="PROP2/>
</model:widgetspecification>

The actual result:

<?xml version="1.0" encoding="ASCII"?>
<model:DocumentRoot xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:model="http://test.com/model">
  <widgetspecification description="DESC" name="NAME">
    <property name="PROP1"/>
    <property name="PROP2"/>
  </widgetspecification>
</model:DocumentRoot>

And finally the save procedure (just output to sysout)

Resource resource = new XMIResourceImpl();
resource.getContents().add(modelRoot);
resource.save(System.out, Collections.EMPTY_MAP);

Sadly I couldn’t find any relevant differences in the saving routines (although of course the EMF generated code is a lot more complicated) – I guess I may have missed s.th. but I still haven’t found anything).
Also interesting is the fact, that the EMF generated file is UTF-8, but I can’t find any reference where this option is set.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:21:59+00:00Added an answer on June 4, 2026 at 7:21 am

    Use XMLResource instead of XMIResource and set OPTION_EXTENDED_META_DATA to true.

    XMLResource resource = new XMLResourceImpl();
    resource.setEncoding("UTF-8");
    resource.getContents().add(modelRoot);
    Map<Object, Object> options = new HashMap<>();
    options.put(XMLResource.OPTION_EXTENDED_META_DATA, true);
    resource.save(System.out, options);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

currently i'm using EMf to read ~400 xml files. Each file has about 100.000
EMF has support for XSD through Ecore to XSD import export capability, but I
I am working on some code using the EMF framework in Java, but it
Using Java,I have to fetch multiple sets of values from an XML file to
Using Yii, I want to delete all the rows that are not from today.
is there a skeleton for a project using mysql, some eclipse/top link with RESOURCE_LOCAL
I am using Java EE 6. Just want to throw it out there first
I'm using EEF to create property editors for an EMF model I'm working on.
Using a ClassPathXmlApplicationContext object I want to get the same EntityManager that is being
I'm looking into using XText to make an extenstion DSL to a language that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.