Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving "xmi" namespace #16

Open
mario-van-zadel opened this issue Sep 5, 2019 · 3 comments
Open

Resolving "xmi" namespace #16

mario-van-zadel opened this issue Sep 5, 2019 · 3 comments

Comments

@mario-van-zadel
Copy link

Hi,

I'm trying to parse a XMI file which has a xmi:XMI root node (like shown in the example at https://www.euclideanspace.com/software/information/xml/xmi/index.htm):

<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:types="http://www.eclipse.org/xtext/common/JavaVMTypes" xmlns:xbase="http://www.eclipse.org/xtext/xbase/Xbase">
...
</xmi:XMI>

If I try to parse this file, I get the following error:

terminate called after throwing an instance of 'std::logic_error'
what(): missing package: xmi
Aborted (core dumped)

I think that the reason is that there's no meta model found in the MetaModelRepository for the namespace xmi.

This is the code I'm using to register the meta models in the repository:

::ecorecpp::MetaModelRepository_ptr repository = ::ecorecpp::MetaModelRepository::_instance();

::ecore::EcorePackage_ptr ecorePackage = ::ecore::EcorePackage::_instance();
repository->load(ecorePackage);

::types::TypesPackage_ptr typesPackage = ::types::TypesPackage::_instance();
repository->load(typesPackage);

::xbase::XbasePackage_ptr xbasePackage = ::xbase::XbasePackage::_instance();
repository->load(xbasePackage);

Do I have to add another package to the registry to be able to parse XMI files with a xml:XMI root node?

Thank you in advance!

Best regards,
Mario

@srhenning
Copy link
Contributor

I'm afraid that's not easily possible. You would need an ecore representation of the XMI model. If I have understood your question correctly, you can find an answer for a possible way here:
https://stackoverflow.com/questions/10303280/uml-xmi-to-ecore

Hope this helps!

Best regards,
Soeren

@srhenning
Copy link
Contributor

Hello Mario,

I have looked again into the example xmi (euclidian space) mentioned by you. In the section 'Top level object' two versions of serialization are shown:

<xmi:XMI xmi:version="2.0" ...>

</xmi:XMI>

or

<EuclideanSpace xmi:version="2.0" ...>.

Currently we only support the second version. So if you change the structure of your xmi you might be able to parse it. If we find the time we will support the first form in an upcoming version of emf4cpp. This requires a change in the implementation of the XMLResource framework.

Best regards,
Soeren

@mario-van-zadel
Copy link
Author

Hi Soeren,

thank you for taking time to reply to my request! It helps me to ensure that I'm not using emf4cpp in a wrong way.

I'll try to transform my XMI file from the xmi:XMI version to the version without the xmi:XMI root node.

Should I close this issue or do you need it for the further implementations?

Best regards
Mario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants