2 Replies Latest reply on Aug 22, 2006 12:55 PM by ThinkSeed

    ignoreWhite doesn't strip carriage returns?

    ThinkSeed
      I have read in many resources that ignoreWhite gets rid of all carriage returns. Yet, when I run this simple example, I see a visible carriage return (2 in fact) in the output panel. What is going on here?

      XML:
      <?xml version="1.0" encoding="UTF-8"?>
      <portfolio>
      <section sectionName="signature">
      <content filename="filename.swf" caption="hello">
      This is the text that goes in here.
      </content>
      </section>
      </portfolio>

      ActionScript:
      var myXML:XML = new XML();
      myXML.ignoreWhite = true;
      myXML.onLoad = function (success:Boolean):Void {
      if (success) {
      trace(this);
      }
      else {
      trace("Error loading XML file");
      }
      };
      myXML.load("portfolio.xml");

      Here is a screen shot of the output panel:

      http://www.thinkseed.com/test/ignoreWhite_output.gif
        • 1. Re: ignoreWhite doesn't strip carriage returns?
          abeall Level 3
          ignoreWhite doesn't strip returns from inside the text of a node, or else it would mess up text formatting.
          • 2. ignoreWhite doesn't strip carriage returns?
            ThinkSeed Level 1
            Two things seem to solve this problem:

            Adding a CDATA tag to the XML file:

            <?xml version="1.0" encoding="UTF-8"?>
            <portfolio>
            <section sectionName="signature">
            <content filename="filename.swf" caption="hello">
            <![CDATA[This is the text that goes in here.]]>
            </content>
            </section>
            </portfolio>

            Or just simply getting rid of the carriage returns:

            <?xml version="1.0" encoding="UTF-8"?>
            <portfolio>
            <section sectionName="signature">
            <content filename="filename.swf" caption="hello">This is the text that goes in here.</content>
            </section>
            </portfolio>