|
|
|
Re: Problem creating XML model with model editor [message #427363 is a reply to message #427358] |
Fri, 13 February 2009 20:57 |
Ed Merks Messages: 33136 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/
|
|
|
Powered by
FUDForum. Page generated in 0.02717 seconds