Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Problem creating XML model with model editor
Problem creating XML model with model editor [message #427352] Fri, 13 February 2009 06:15 Go to next message
Ander is currently offline Ander
Messages: 19
Registered: July 2009
Junior Member
Hello,


I have created an Eclipse EMF model from a XSD file (concretely from XML
Schema of SCXML).

I generated the editor, and when I use it, the file created doesn't
conform tho the metamodel. It puts scxml: before each model element. The
file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<scxml:scxml xmlns:scxml="http://www.w3.org/2005/07/scxml"
initialstate="idle">
<scxml:state id="on">
<scxml:transition/>
<scxml:transition/>
</scxml:state>
<scxml:state id="off">
<scxml:transition/>
</scxml:state>
<scxml:state id="idle">
<scxml:transition/>
</scxml:state>
</scxml:scxml>


instead of looking like that:


<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" initialstate="idle">
<state id="on">
<transition/>
<transition/>
</state>
<state"off">
<transition/>
</state>
</scxml>


Does anybody know what could I do to solve this problem?
Re: Problem creating XML model with model editor [message #427356 is a reply to message #427352] Fri, 13 February 2009 09:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25919
Registered: July 2009
Senior Member
Ander,

Comments below.

Ander Zubizarreta wrote:
> Hello,
>
>
> I have created an Eclipse EMF model from a XSD file (concretely from XML
> Schema of SCXML).
>
> I generated the editor, and when I use it, the file created doesn't
> conform tho the metamodel. It puts scxml: before each model element. The
> file looks like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <scxml:scxml xmlns:scxml="http://www.w3.org/2005/07/scxml"
> initialstate="idle">
> <scxml:state id="on">
> <scxml:transition/>
> <scxml:transition/>
> </scxml:state>
> <scxml:state id="off">
> <scxml:transition/>
> </scxml:state>
> <scxml:state id="idle">
> <scxml:transition/>
> </scxml:state>
> </scxml:scxml>
>
>
> instead of looking like that:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <scxml xmlns="http://www.w3.org/2005/07/scxml" initialstate="idle">
> <state id="on">
> <transition/>
> <transition/>
> </state>
> <state"off">
> <transition/>
> </state>
> </scxml>
>
>
> Does anybody know what could I do to solve this problem?
These two serializations are 100% equivalent so both are presumably
correct. You can control the prefix with
documentRoot.getXMLNSPrefixMap().put("", SCXMLPackage.eNS_URI)...
Re: Problem creating XML model with model editor [message #427358 is a reply to message #427356] Fri, 13 February 2009 10:40 Go to previous messageGo to next message
Ander is currently offline Ander
Messages: 19
Registered: July 2009
Junior Member
Ok, how could I do that, if I am creating the model with the wizard?
Thanks,

Ander


Ed Merks wrote:
> Ander,
>
> Comments below.
>
> Ander Zubizarreta wrote:
>> Hello,
>>
>>
>> I have created an Eclipse EMF model from a XSD file (concretely from XML
>> Schema of SCXML).
>>
>> I generated the editor, and when I use it, the file created doesn't
>> conform tho the metamodel. It puts scxml: before each model element. The
>> file looks like:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <scxml:scxml xmlns:scxml="http://www.w3.org/2005/07/scxml"
>> initialstate="idle">
>> <scxml:state id="on">
>> <scxml:transition/>
>> <scxml:transition/>
>> </scxml:state>
>> <scxml:state id="off">
>> <scxml:transition/>
>> </scxml:state>
>> <scxml:state id="idle">
>> <scxml:transition/>
>> </scxml:state>
>> </scxml:scxml>
>>
>>
>> instead of looking like that:
>>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <scxml xmlns="http://www.w3.org/2005/07/scxml" initialstate="idle">
>> <state id="on">
>> <transition/>
>> <transition/>
>> </state>
>> <state"off">
>> <transition/>
>> </state>
>> </scxml>
>>
>>
>> Does anybody know what could I do to solve this problem?
> These two serializations are 100% equivalent so both are presumably
> correct. You can control the prefix with
> documentRoot.getXMLNSPrefixMap().put("", SCXMLPackage.eNS_URI)...
Re: Problem creating XML model with model editor [message #427363 is a reply to message #427358] Fri, 13 February 2009 15:57 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25919
Registered: July 2009
Senior Member
Ander,

If you look in the wizard, you'll see where it creates the document root
and the root element. You could specialize that. Of course you'll want
to change it to not do it reflectively. Probably more like what you see
in SCXMLExample.java that's in the *.tests project when you invoke
generate test code.



Ander Zubizarreta wrote:
> Ok, how could I do that, if I am creating the model with the wizard?
> Thanks,
>
> Ander
>
>
> Ed Merks wrote:
>> Ander,
>>
>> Comments below.
>>
>> Ander Zubizarreta wrote:
>>> Hello,
>>>
>>>
>>> I have created an Eclipse EMF model from a XSD file (concretely from
>>> XML
>>> Schema of SCXML).
>>>
>>> I generated the editor, and when I use it, the file created doesn't
>>> conform tho the metamodel. It puts scxml: before each model element.
>>> The
>>> file looks like:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <scxml:scxml xmlns:scxml="http://www.w3.org/2005/07/scxml"
>>> initialstate="idle">
>>> <scxml:state id="on">
>>> <scxml:transition/>
>>> <scxml:transition/>
>>> </scxml:state>
>>> <scxml:state id="off">
>>> <scxml:transition/>
>>> </scxml:state>
>>> <scxml:state id="idle">
>>> <scxml:transition/>
>>> </scxml:state>
>>> </scxml:scxml>
>>>
>>>
>>> instead of looking like that:
>>>
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <scxml xmlns="http://www.w3.org/2005/07/scxml" initialstate="idle">
>>> <state id="on">
>>> <transition/>
>>> <transition/>
>>> </state>
>>> <state"off">
>>> <transition/>
>>> </state>
>>> </scxml>
>>>
>>>
>>> Does anybody know what could I do to solve this problem?
>> These two serializations are 100% equivalent so both are presumably
>> correct. You can control the prefix with
>> documentRoot.getXMLNSPrefixMap().put("", SCXMLPackage.eNS_URI)...
Previous Topic:XMI serialization of data type to external file and CDO
Next Topic:Coding Practices: auto-renaming children
Goto Forum:
  


Current Time: Fri Jul 25 12:04:05 EDT 2014

Powered by FUDForum. Page generated in 0.01810 seconds