Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to fill AnyType mixed content with Java code
How to fill AnyType mixed content with Java code [message #1122582] Tue, 01 October 2013 14:33 Go to next message
Robert Neßelrath is currently offline Robert Neßelrath
Messages: 12
Registered: April 2013
Junior Member
Hi,

I need to programmatically fill the mixed content of an AnyType Element. The Model is generated from a xml schema and contains mixed html content, e.g.:

this is <a href=link" title="title"/> an example

I've already found out, how to fill the text element:

org.eclipse.emf.ecore.util.FeatureMapUtil.addText(anyType.getMixed(), "text");


I am still searching for a solution for the inner anchor-tag. Somehow I have to create an EReference instance and add this together with another FeatureMap as value to the anyType.getMixed() - feature map. The second feature map is then filled with the attribute values. I am facing two problems:

1. How can I instantiate the second Feature map?
2. How to create a correct EReference-instance, that correctly works with this feature map?

Thank you very much !
Robert
Re: How to fill AnyType mixed content with Java code [message #1123054 is a reply to message #1122582] Wed, 02 October 2013 02:30 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26013
Registered: July 2009
Senior Member
Robert,

Comments below..

On 01/10/2013 8:33 PM, Robert Neßelrath wrote:
> Hi,
>
> I need to programmatically fill the mixed content of an AnyType
> Element. The Model is generated from a xml schema and contains mixed
> html content, e.g.:
>
> this is <a href=link" title="title"/> an example
>
> I've already found out, how to fill the text element:
>
> org.eclipse.emf.ecore.util.FeatureMapUtil.addText(anyType.getMixed(),
> "text");
You've looked at
http://www.theserverside.com/tt/articles/article.tss?l=BindingXMLJava
and at http://www.eclipse.org/modeling/emf/docs/overviews/FeatureMap.pdf?
>
> I am still searching for a solution for the inner anchor-tag. Somehow
> I have to create an EReference instance
One doesn't already exist? A wildcard is involved.
> and add this together with another FeatureMap as value to the
> anyType.getMixed() - feature map.
That doesn't make sense. A FeatureMap can't be a value of an entry.
> The second feature map is then filled with the attribute values. I am
> facing two problems:
>
> 1. How can I instantiate the second Feature map?
You can't. You can instantiate an EObject, e.g., an AnyType instance
that holds a feature map, but you can't just instantiate a feature map
by itself.
> 2. How to create a correct EReference-instance, that correctly works
> with this feature map?
If one doesn't already exist, you can demand create one. Have a look at
the first article. I'm sure you'll get the idea.
>
> Thank you very much !
> Robert
>
Previous Topic:EMF generating compile errors with enums
Next Topic:Generating model project .. only available if source level is 1.5 or greater -- but I AM greater?!
Goto Forum:
  


Current Time: Thu Aug 28 21:43:10 EDT 2014

Powered by FUDForum. Page generated in 0.01971 seconds