Skip to main content


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 11:15 Go to next message
Ander is currently offline AnderFriend
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 14:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
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)...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problem creating XML model with model editor [message #427358 is a reply to message #427356] Fri, 13 February 2009 15:40 Go to previous messageGo to next message
Ander is currently offline AnderFriend
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 20:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
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)...


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:XMI serialization of data type to external file and CDO
Next Topic:Coding Practices: auto-renaming children
Goto Forum:
  


Current Time: Tue Apr 16 22:14:56 GMT 2024

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

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

Back to the top