Value must be stored in EMF model but should not propagate to xml file

94 views Asked by At

I have a EMF model which is filled and finally used to generate a xml file.

I have one requirement where EMF model should contain the data but it should not be propagated to xml file at the end.

for ex: I have ecore model which produces below kind of xml

<component>
     <rule>123</rule>
     <desc>unknown</desc>
</component> 

Now I want to introduce one more Eatrribute say severity. I would like to set the value for it. But this should not be coming in final xml file generated. That is even after introducing the new EAttribute the xml file should look the same.

Is there any way we can do this in EMF by setting any property in the for the attribute or by any other way.

1

There are 1 answers

0
Brett Kail On BEST ANSWER

Setting the transient property of the EAttribute will prevent it from being serialized (it will be reset to the default value when read), which is basically the same effect as the transient keyword in Java serialization.