federubin
federubin

Reputation: 636

leading and trailing whitespace stripped from content of a text node when loading an XML file

In actionscript 3, when trying to load an XML file like

<Element><Property> a </Property></Element>

the value in the node "property" will be just "a", trailing and leading whitespaces are removed.

I did what http://bugs.adobe.com/jira/browse/ASC-3125 recomends, with no success. Any ideas?

Upvotes: 3

Views: 3234

Answers (3)

federubin
federubin

Reputation: 636

As described before, XML.prettyPrinting didn't work. Finally it got fix by adding XML.ignoreWhitespace = false;

After that line of code, the trailing spaces are not removed.

Upvotes: 4

grapefrukt
grapefrukt

Reputation: 27045

XML.prettyPrinting = false

Should work just fine, this is what I use for this exact problem. But do note that this is a global setting and can result in new bugs in other places in your app.

Upvotes: 1

quoo
quoo

Reputation: 6307

I believe if you put it inside CDATA tags, you'll get the whitespace.

<Element><Property><![CDATA[ a ]]></Property></Element>

Upvotes: 2

Related Questions