Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Namespace information lost in reference(When referencing to a DocumentRoot of another model, the ns info gets lost)
Namespace information lost in reference [message #1150149] Tue, 22 October 2013 15:23 Go to next message
Robert Neßelrath is currently offline Robert NeßelrathFriend
Messages: 13
Registered: April 2013
Junior Member
Hi,

I have a problem with an ecore-model generated from a xml-schema. The source-schema is for the speech synthesis markup language ssml. I took the xsd-files, generated a model and generated editor code for this model. With the generated ssml-editor everything works fine. Here an example of the code:
<?xml version="1.0" encoding="UTF-8"?>
<speech_synthesis:speak xmlns:speech_synthesis="http://www.w3.org/2001/10/synthesis">this is a<speech_synthesis:s>test</speech_synthesis:s></speech_synthesis:speak>


You can see, that here the namespace information for all elements is available. Now I tried to add the DocumentRoot class of this generated model to another model, by defining a reference. The result of the file, created by the editor is now this one:

  <presentation xsi:type="io:SpeechSynthesis" device="speaker" modality="speech" language="de-DE">
                <ssmlDocument>
                  <speak>
                  	this is a 
                    <s>
                     test
                     <s/>
                  </speak>
                </ssmlDocument>
              </presentation>


You can see that the namespace information is missing. This is not only a problem for me, it makes it impossible to reload this file into the editor:

org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 's' not found.


Any idea how to solve this issue?
Thanks a lot,
Robert

[Updated on: Tue, 22 October 2013 15:29]

Report message to a moderator

Re: Namespace information lost in reference [message #1150232 is a reply to message #1150149] Tue, 22 October 2013 16:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30372
Registered: July 2009
Senior Member
Robert,

Comments below.

On 22/10/2013 5:23 PM, Robert Neßelrath wrote:
> Hi,
>
> I have a problem with an ecore-model generated from a xml-schema. The
> source-schema is for the speech synthesis markup language ssml. I took
> the xsd-files, generated a model and generated editor code for this
> model. With the generated ssml-editor everything works fine. Here an
> example of the code:
> <?xml version="1.0" encoding="UTF-8"?>
> <speech_synthesis:speak
> xmlns:speech_synthesis="http://www.w3.org/2001/10/synthesis">this is
> a<speech_synthesis:s>test</speech_synthesis:s></speech_synthesis:speak>
>
> You can see, that here the namespace information for all elements is
> available. Now I tried to add the DocumentRoot class of this generated
> model to another model, by defining a reference.
Hmm. That doesn't really make sense if you want some well formed XML
that conforms to the schema.... In XML Schema you'd refer to some
global element of another schema, so you need to do something that
matches this approach.
> The result of the file, created by the editor is now this one:
>
> <presentation xsi:type="io:SpeechSynthesis" device="speaker"
> modality="speech" language="de-DE" utterance="Willkommen beim
> Sprach-Browser von BMW">
> <ssmlDocument>
> <speak>
> this is a <s>
> test
> <s/>
> </speak>
> </ssmlDocument>
> </presentation>
>
> You can see that the namespace information is missing. This is not
> only a problem for me, it makes it impossible to reload this file into
> the editor:
> org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 's' not
> found.
Yes, it's all not sensible.
>
> Any idea how to solve this issue?
Are you writing this other model directly in Ecore? Better you write a
small schema instead (even export your Ecore's corresponding *.genmodel
to an XML Schema and ensure that you use a global element from your
other schema or use a complex type from your other schema. Don't use
the DocumentRoot like this. It only functions, as the name implies, as
the root object in a resource/document...
> Thanks a lot,
> Robert
Re: Namespace information lost in reference [message #1151313 is a reply to message #1150232] Wed, 23 October 2013 09:04 Go to previous message
Robert Neßelrath is currently offline Robert NeßelrathFriend
Messages: 13
Registered: April 2013
Junior Member
The other model is written in Ecore, quite complex and linked to several other models. So I prefered not to write or generate a schema for this. If I add not the DocumentRoot but the first element of it instead, I face the same problem. But I have found a solution for the problem by creating a small example ecore model, that refers to the DocumentRoot. Here it worked correclty and the only difference was the Model Resource Type setting in the genmodel. After changing this from XMI to XML in the more complex model it also adds the namespaces to the serialized model.
Previous Topic:cdo server on windows xp
Next Topic:Execute Command without stacking on CommandStack
Goto Forum:
  


Current Time: Sun Aug 25 12:22:03 GMT 2019

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

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

Back to the top