Required attributes missing in generated XML from EMF editor [message #418761] |
Mon, 28 April 2008 21:13 |
Eclipse User |
|
|
|
Originally posted by: roberto.milev.gmail.com
Hi,
I have a EMF model that I generated form a XML schema. In the schema I
have a bunch of required attributes (use="required") for my elements. I
was able to generate an editor from the .genmodel. However unless I
explicitly change the values of each attribute they are not included in
the XML produced by the editor. (I guess they get defaults, but
nevertheless this produces XML that does not comply to the XML Schema)
Is there a way to model this, so that all the required attributes are
always included in the result XML?
Thank you,
Roberto
|
|
|
|
Re: Required attributes missing in generated XML from EMF editor [message #418778 is a reply to message #418764] |
Tue, 29 April 2008 13:40 |
Eclipse User |
|
|
|
Originally posted by: roberto.milev.gmail.com
Ed,
Setting defaults in the XML schema, and
XMLResource.OPTION_KEEP_DEFAULT_CONTENT to true did exactly what I
wanted. Thank you!
Ed Merks wrote:
> Roberto,
>
> Making a feature required is the same as saying that the user must
> explicitly set a value. You'll note that in XML Schema you can give a
> feature a default value, but in that case, you can't also make it
> required. You might want to fiddle with
> XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force default values to be
> serialized...
>
>
> Roberto Milev wrote:
>> Hi,
>>
>> I have a EMF model that I generated form a XML schema. In the schema I
>> have a bunch of required attributes (use="required") for my elements.
>> I was able to generate an editor from the .genmodel. However unless I
>> explicitly change the values of each attribute they are not included
>> in the XML produced by the editor. (I guess they get defaults, but
>> nevertheless this produces XML that does not comply to the XML Schema)
>>
>>
>> Is there a way to model this, so that all the required attributes are
>> always included in the result XML?
>>
>> Thank you,
>> Roberto
|
|
|
Powered by
FUDForum. Page generated in 0.01839 seconds