Skip to main content


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 18:33 Go to next message
Robert Neßelrath is currently offline Robert NeßelrathFriend
Messages: 14
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 06:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
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
>


Ed Merks
Professional Support: https://www.macromodeling.com/
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 Mar 28 21:10:00 GMT 2024

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

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

Back to the top