Показать сообщение отдельно
Старый 09.09.2009, 18:06
antrekot вне форума Посмотреть профиль Отправить личное сообщение для antrekot Найти все сообщения от antrekot
  № 1  
Ответить с цитированием
antrekot

Регистрация: Apr 2008
Сообщений: 13
По умолчанию Пример из книжки - запись xml

Взял пример с книжки "Learning ActionScript- Rich Shupe with Zevan Rosser" на тему передачи xml на сервер.

Код AS1/AS2:
var xmlString:String="<?xml version='1.0' encoding='utf-8'?><root><value>1</value></root>";
var book:XML = new XML(xmlString);
var xmlResponse:XML;
xml_text.text = book;
 
var xmlURLReq:URLRequest = new URLRequest("http://localhost/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;
	}
}
 
function onIOError(evt:IOErrorEvent):void {
	respTxt.text = "An error occurred when attempting to load the XML.\n" + evt.text;
}
При запуске выдается ошибка:
Error #1088: The markup in the document following the root element must be well-formed.

Xml просто и где там может быть ошибка - не понимаю.
Скажите плиз, где искать причину?