Marco Naddeo Messages: 49 Registered: November 2012
Member
Hi all
I'd like to call the serializer preserving the original formatting, while when I call it, the format of the resulting textual representation is determined by the Formatter.
Is it possible in some way to preserve original formatting?
I read in the documentation that SaveOptions can be passed to the serializer to disable the formatter:
Quote:
If disabled, the formatter only defines white space information for the places in which no white space information can be preserved from the node model.
but I cannot understand how. [And I do not know if this affects what I want. ]
Look at the SaveOptions class. I think you create one, and then tell it
to "preserve whitespace" or somesuch. That means "no formatting".
Inserting spaces then takes place only where there is not source text as
the source of the model (i.e, when there are semantic changes that are
not (yet) reflected in text.
Hope that helps.
- henrik
On 2013-18-01 16:01, Marco Naddeo wrote:
> Hi all
>
> I'd like to call the serializer preserving the original formatting,
> while when I call it, the format of the resulting textual representation
> is determined by the Formatter.
>
> Is it possible in some way to preserve original formatting?
>
> I read in the documentation that SaveOptions can be passed to the
> serializer to disable the formatter:
>
> Quote:
>> If disabled, the formatter only defines white space information for
>> the places in which no white space information can be preserved from
>> the node model.
>
>
> but I cannot understand how. :( [And I do not know if this affects what
> I want. :?]
>
> Could you please help me? :roll:
>
> Marco
Marco Naddeo Messages: 49 Registered: November 2012
Member
I tried to set a SaveOptions object and to pass it to the Serializer on the call of:
public String serialize(EObject obj, SaveOptions options)
but with both true or false for the formatting option, it does not change anything.
Any ideas?
Henrik Lindberg wrote on Fri, 18 January 2013 13:08
Look at the SaveOptions class. I think you create one, and then tell it
to "preserve whitespace" or somesuch. That means "no formatting".
Inserting spaces then takes place only where there is not source text as
the source of the model (i.e, when there are semantic changes that are
not (yet) reflected in text.