[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: xml transformation?

Marc,

Comments below.


Marc Baumbach wrote:
Hi Ed,

We're looking to do something a bit odd, but hopefully there's a way to accomplish it. See the below example for what we'd like to transform:

<elementName key="someStr#someValue" value="someContent"/>

Transform to:

<myns:someValue xmlns:myns="someStr#">someContent</myns:someValue>
Having the namespace encode user data has some precedent in terms of QName values doing that, but having the element names themselves represent user data is definitely a bit odd.

The most important part is can we turn content in an attribute into an element name and can we do any processing on that content before doing so? I've looked into ExtendedMetaData, but I don't know if that provides enough function to be able to do this complex processing.
No, because it's dealing with mapping to the Ecore model, not with instance data.
I see the XMLHandler, and XMLSaveImpl/XMLLoadImpl, but those are relatively complex. Perhaps a small snippet if you know a quick way to do something similar to this.
In XMLHandler you'd probably need to specialize handleFeature. You might want to set a breakpoint there and observe how that method is reached and how the information is normally processed. Similarly, have a look at which method XMLSaveImpl.saveFeatures calls for that particular kind of feature and specialize that method to do special processing for this case.

Thanks in advance!