You need to set XML.ignoreWhitespace = false; and use the white space collapse argument in the importFromXML method like this:
summary.textFlow = TextFlowUtil.importFromXML(summaryXml, WhiteSpaceCollapse.PRESERVE);
Many thanks for replying. Unfortunately, your suggestion bypasses the problem. The problem is I am starting from a STRING not XML. It's getting the String into an XML whilst preserving the whitespace that is the root of the problem.
I am not simply exporting and re-importing to/from XML, I am exporting to XML, persisting this as a STRING, and then I need to re-import from that STRING. It's the creation of an XML object from a STRING that actually is the culprit, not really the Textflow export/import to XML.
Perhaps you've got a nice simple solution for that one...?
1 person found this helpful
The solution for this problem consists of two parts.
First part is exporting the xml from the textflow, you want no formatted XML (with breaks, tabs, ...), but one long string with the spaces left like there were entered between the tags, this can be done with:
_textXML = TextConverter.export(EditorID.textFlow,TextConverter.TEXT_LAYOUT_FORMAT,ConversionType.STRING_TYPE) as String;
Use the TextConverter in stead of the TextFlowUtil.
Second part is back importing to textFlow:
There the solution mentioned above was correct.
XML.ignoreWhitespace = false;
var flowXML:XML = new XML(_textXML);
contentTLF = TextFlowUtil.importFromXML(flowXML,WhiteSpaceCollapse.PRESERVE);