Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356576

Summary: XMLMixedContentFormatter must use system line separator
Product: [Modeling] M2T Reporter: Karsten Thoms <karsten.thoms>
Component: XpandAssignee: Karsten Thoms <karsten.thoms>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: 1.1.0Flags: karsten.thoms: kepler+
Target Milestone: M4   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 400672    

Description Karsten Thoms CLA 2011-09-02 08:15:10 EDT
In class XMLMixedContentFormatter line breaks are introduced by using "\n". Instead, the system's line seperator System.getProperty("line.separator") must be used.
Comment 1 Karsten Thoms CLA 2011-09-02 08:18:04 EDT
Fixed
Comment 2 Sebastian Zarnekow CLA 2012-10-10 04:46:21 EDT
The formatter now produces character sequences like &#xD; on windows boxes.
Comment 3 Karsten Thoms CLA 2012-11-28 10:31:23 EST
The main problem was that character escaping is on by default. Therefore default save option was added.
  opt.put(XMLResource.OPTION_SKIP_ESCAPE, Boolean.TRUE);

Note that this save option can already added by configuration to work around the issue. XMLBeautifier offers the method addSaveOption(OptionsEntry).

In MWE1 you would configure it like follows:
...
  <postprocessor class="org.eclipse.xtend.typesystem.xsd.XMLBeautifier">
    <saveOption class="org.eclipse.xtend.typesystem.xsd.OptionsEntry" key="SKIP_ESCAPE" value="true"/>
  </postprocessor>

However, the line separation can now be influenced by XMLBeautifier#setLineSeparator(String). By default, UNIX style will be used. Other options are WINDOWS and SYSTEM.

Added test case XMLBeautifierTest.
Comment 4 Karsten Thoms CLA 2012-11-29 16:00:10 EST
changeset: 4e95d7b066cc528acf198069a860be8935f8e8b9
Comment 5 Eclipse Webmaster CLA 2017-10-31 10:48:56 EDT
Requested via bug 522520.

-M.
Comment 6 Eclipse Webmaster CLA 2017-10-31 10:59:59 EDT
Requested via bug 522520.

-M.