|
Re: XSD to Ecore: Group renamed to Group1 [message #1823932 is a reply to message #1823901] |
Sat, 04 April 2020 05:20 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
I expect you are not using the generated XyzResourceFactoryImpl to save your resource. The class contains this method public Resource createResource(URI uri)
{
XMLResource result = new XyzResourceImpl(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
return result;
} Those options are important for the extended metadata annotations on the Ecore model to be used properly during loading and saving.
So be sure which factory is being used to create your resource. This will generally depend on the file extension you use because that's registered in the plugin.xml <extension point="org.eclipse.emf.ecore.extension_parser">
<!-- @generated xyz-->
<parser
type="xyz"
class="org.eclipse.example.xyz.util.XyzResourceFactoryImpl"/>
</extension> Via the GenPackage's properties (nested under the GenModel at the root of the *.genmodel resource), the File Extensions property controls what's in the plugin.xml It's also possible to specify a Content Type Identifier so that you can reuse extension xml, but then you have to be sure to create the resource using org.eclipse.emf.ecore.resource.ResourceSet.createResource(URI, String), specifying your Content Type Identifier a constant for which will be in your generated XyzPackage.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25703 seconds