1 Reply Latest reply on May 8, 2012 3:07 PM by chris4600

    Problem with XML and different line break styles

    chris4600

      I am working on a project that is being worked on by some developers running Flash Builder 4.6 in Windows and some developers running Flash Builder 4.6 in OSX. We are having trouble due to the difference in line breaks between the two environments. In an .as file with UNIX-style line breaks is code similar to the following:

       

      var xml:XML = <document>

      <element>

      </element>

      </document>;

       

      xml.appendChild(SomeClass.getXML());

       

      SomeClass.getXML() is in an .as file that uses Windows-style line breaks, and is similar to the following:

       

      public function getXML():XML

      {

      var moreXML:XML = <anotherElement>

      <childElement>

      </childElement>

      </anotherElement>;

       

      return moreXML;

      }

       

      When the XML object is serialized and written to a file on a Windows machine, it looks like this:

       

      <document>

      <element>

      </element>

      <anotherElement>

       

      <childElement>

       

      </childElement>

       

      </anotherElement></document>

       

      The line breaks for everything outside of anotherElement are of the form \r\n. The line breaks within it are of the form \r\r\n, thus causing the blank lines. I am guessing that the odd line breaks are the cause of the odd indenting, as well. Neither of these problems happen when XML is appended to xml an .as file that employes UNIX-style line breaks.

       

      Is there any way to force Flash Builder to always use UNIX-style line breaks under Windows? If not, are there any relatively clean solutions to this issue? Thanks!

       

      Clarified topic