Skip to main content
sbryner
Inspiring
July 14, 2009
Question

XML - writing file #1088 (xml not well formed)

  • July 14, 2009
  • 1 reply
  • 458 views

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;
}

This topic has been closed for replies.

1 reply

sbryner
sbrynerAuthor
Inspiring
July 14, 2009

Answered it myself....

The PHP script was adding additional<tags></tags> so the file I was outputing read:

<root>

<teams>

<team1></team1>

<team2></team2>

</teams>

</root>

<phpaddedInfo></phpaddedInfo>

so just a good idea to look in both places when you get an IO error #1088