XML - writing file #1088 (xml not well formed)
Hi,
What could cause the IO Error #1088 within the code below? All I can think of is white space issue. It prints to the screen AND saves to the xml file correctly, just keeps throwing up the code.
Also, writing it this way wont' allow me to add <?xml version='1.0' encoding='utf-8'?> is it required?
Thanks for any help.
var authors:XML;
authors =<authors>
<author>
<firstname>Rich</firstname>
<lastname>Shupe</lastname>
</author>
<author>
<firstname>Zevan</firstname>
<lastname>Rosser</lastname>
</author>
</authors>;
var xml =authors;
var book:XML = new XML(xml);
var xmlResponse:XML;
var xmlURLReq:URLRequest = new URLRequest("saveXML.php");
xmlURLReq.data = book;
xmlURLReq.contentType = "text/xml";
xmlURLReq.method = URLRequestMethod.POST;
var xmlSendLoad:URLLoader = new URLLoader();
xmlSendLoad.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
xmlSendLoad.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
xmlSendLoad.load(xmlURLReq);
function onComplete(evt:Event):void {
try {
xmlResponse = new XML(evt.target.data);
respTxt.text = xmlResponse;
removeEventListener(Event.COMPLETE, onComplete);
removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
} catch (err:TypeError) {
respTxt.text = "An error occured when communicating with server:\n" + err.message+" "+xml;
}
}
function onIOError(evt:IOErrorEvent):void {
respTxt.text = "An error occurred when attempting to load the XML.\n" + evt.text;
}