Export xml and importing it back in
I've got an issue I can't seem to find an answer to on the forums or otherwise.
I'm creating a screenwriting app in AIR that saves a file to the user's local machine.
If I place this line of code for the import on the constructor it works fine and sets up the document for writing.
private const textMarkup:String = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008' verticalScrollPolicy='auto' horizontalScrollPolicy='auto' fontSize='12' fontFamily='Courier New' paddingTop='60' paddingLeft='120' paddingRight='55' typographicCase='uppercase' xmlns='http://ns.adobe.com/textLayout/2008'></TextFlow>";
Now, I have an export function that exports this data out as an XML
public function exportScript():void {
var exportXML:XML = TextConverter.export(textFlow, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.XML_TYPE) as XML;
var myScript:String = "myScript";
exportFile.save(exportXML, myScript + '.FadeIn');
}
This function works perfectly. However, when it saves the XML file the formatting is altered. I get this.
<TextFlow fontFamily="Courier New" fontSize="12" horizontalScrollPolicy="auto" paddingLeft="120" paddingRight="55" paddingTop="60" typographicCase="uppercase" verticalScrollPolicy="auto" whiteSpaceCollapse="preserve" version="2.0.0" xmlns="http://ns.adobe.com/textLayout/2008">
<p>
<span></span>
</p>
</TextFlow>
Because of the " replacing ' and the // it tosses the whole thing out of whack and won't import correctly.
