Hi Cam, It's not an API type thing, but you can look for the EMF2DOM(SSE?)Adapter [there's one for straight DOM and one for SSE] on the EMF object (see EcoreUtil.getExistingAdapter()). From there, you should be able to track through to the corresponding XML node. The adapter is an EMF adapter that responds to changes in the EMF model, and uses the Translators to convert the value to one that can be parsed into an XML change (either element or attribute value). When using SSE, there's something similar on the SSE model side (another adapter looking for changes directly to the SSE model), so if you track back an SSE model and making changes, you'll be in sync. I don't believe DOM responds to changes in the DOM, so be aware that any changes you make there, you'll have to make in the EMF model as well, if they correspond. Also note that when you change the EMF model, it'll generate the same event into the DOM as well. You'll probably have to do a little digging, and I'd recommend being very careful doing this as making programmatic changes to the XML is not considered a best practice. I'd just recommend that you ensure you've evaluated all other options before doing this.
Generally, anything available in the document (e.g. Namespaces, etc) is available through EMF API. Might be worth double checking that there's not an existing EMF API to do whatever it is you're about to do. ------------------------------------------------------------------------- Kind Regards, Michael D. Elder Rational Studio / Services Tools Development IBM RTP Lab (919) 543-8356 T/L: 441-8356 [EMAIL PROTECTED] http://scribbledideas.blogspot.com/ | http://blogs.tap.ibm.com/weblogs/page/[EMAIL PROTECTED] | http://planetradical.raleigh.ibm.com/ "Developers are like artists; they produce their best work if they have the freedom to do so, but they need good tools." -- Werner Vogels Cameron Bateman <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 12/07/2006 08:35 PM Please respond to "General discussion of project-wide or architectural issues." <[email protected]> To Wtp-dev <[email protected]> cc Subject [wtp-dev] EMF2XML translation reverse mapping Given an EMF object create throught XML2EMF/ArtifactEdit framework, is it currently possible to map back to the XML node that generated that object? If not, has this ever be considered and would be a lot of work? --Cam _______________________________________________ wtp-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/wtp-dev
_______________________________________________ wtp-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/wtp-dev
