Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XML2XML transformation
XML2XML transformation [message #1782588] Mon, 26 February 2018 18:10 Go to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6985
Registered: July 2009
Senior Member

Ecore supports Model2Model transformation by loading a model serialized using XMI as instances of a user metamodel whose elements are instances of Ecore.

It is occasionally necessary to tweak XML and this could be performed by a Model2Model transformation if
a) the XML technology space is loaded as a model in the model technology space
b) the transformation tool is adjusted to work directly on XML in the XML technology space

The latter is unpleasant and not very scalable to other technology spaces.

I suspected that the former would already be available, but after experimenting with XMLResourceFactoryImpl() and looking at DOM support, it seems not,

EMF provides no XML.ecore to model XML elements in EMF, and no variant SAXParser to create the XML.ecore EObjects directly.

Am I mistaken? Has anyone done this? Is there another way?


Ed Willink
Re: XML2XML transformation [message #1782606 is a reply to message #1782588] Tue, 27 February 2018 05:46 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31702
Registered: July 2009
Senior Member
You can use org.eclipse.emf.ecore.xmi.impl.GenericXMLResourceFactoryImpl to load arbitrary XML. If there are XML Schema's available, those will be used to create corresponding Ecore models that are used to represent the instances. If not, just an org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot is created at the root of the resource, and it contains instances of org.eclipse.emf.ecore.xml.type.AnyType, EMF's representation of an XML element, all using demand created metadata. You can read this article for details:

Ed Merks
Professional Support:
Previous Topic:Keeping generated XSD free from ecore
Next Topic:What should I configure NSURI to be?
Goto Forum:

Current Time: Tue Jan 19 13:17:35 GMT 2021

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

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

Back to the top