Leading and trailing spaces removed from node text content when loading an XML file

In ActionScript 3, when you try to load an XML file, for example

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

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

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

+3
source share
3 answers

As described above, XML.prettyPrinting does not work. Finally, he got the fix by addingXML.ignoreWhitespace = false;

After this line of code, trailing spaces are not removed.

+4
source

I believe that if you put it in CDATA tags, you will get spaces.

<Element><Property><![CDATA[ a ]]></Property></Element>
+2
XML.prettyPrinting = false

Should work fine, this is what I use for this exact problem. But note that this is a global setting and may cause new errors to appear elsewhere in your application.

+1
source

Source: https://habr.com/ru/post/1707320/


All Articles