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: 6037
Registered: July 2009
Senior Member
Hi

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?

Regards

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: 29538
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:

http://www.theserverside.com/news/1364302/Binding-XML-to-Java
Previous Topic:Keeping generated XSD free from ecore
Next Topic:CDO failover configuration
Goto Forum:
  


Current Time: Thu Sep 20 00:03:46 GMT 2018

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

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

Back to the top