problem with sending xml data from flash to aspx

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
i have code in flash (as3):

<pre>function xacnhanclick(evt:Event):void
{
var bookedXML:XML=<data/>;

for(var i:uint=0;i<hang;i++)
{

for(var j:uint=0;j<cot;j++)
{
if(ghearray[j]._check==1)
{

bookedXML.data+=
<ghe>
<maghe>{i + + j}</maghe>
<hangindex>{i}</hangindex>
<cotindex>{j}</cotindex>
</ghe>;
//trace(i+" "+j);
}
}

}
sendxml(bookedXML);
}

public function sendxml(xml:XML):void
{

var req:URLRequest = new URLRequest("Chonphong.aspx");


req.method = URLRequestMethod.POST;
req.contentType = "text/xml";
req.data = "<?xml version=1.0 encoding=utf-8 ?>n" + xml;

sendToURL(req);
trace(req.data);
}[/code]
<pre>and i try to get xml data in aspx:[/code]
<pre><div style="color:Black;background-color:White; <pre>
XmlDocument myXmlDoc = new XmlDocument();
myXmlDoc.PreserveWhitespace = true;


myXmlDoc.Load(Request.InputStream);


Response.Write(myXmlDoc.InnerXml);
[/code]
<div style="color:Black;background-color:White; <pre>
but it has an error: "Data at the root level is invalid. Line 1, position 1." ive checked the format of xml data in flash. its correct. please help me
[/code]
<br/>[/code]
<pre><br/>[/code]
<br/>


View the full article
 
Back
Top