Wednesday, December 30, 2009

#1088: The markup in the document following the root element must be well-formed.

I have found this strange issue when i developing with an xml based Slideshow. i have spend more than 2 days spend to fix this.

Why this happening

some cases like if you are not organized your XML schema that time it will throw error. But some cases if you are generating a PHP based or dynamic XML there are some cases to add some Special charcter after the XML and it should be invisible. If any one facing such issue please try with below code

function LoadXML(e:Event):void {
try{
if(e.target.data!="" && e.target.data!=" ") {
var tempstr:String = e.target.data;
tempstr = tempstr.substr(0, tempstr.lastIndexOf("")+10);
xmlData=new XML(tempstr);
LenghtofNodes=xmlData.images.image.length();

album_name.text="Album name : "+xmlData.AlbumDetails.Album[0].attribute('AlbumName')
numbs_photo.text="Total photos : "+LenghtofNodes
for (var i:Number=0; i Image.push(xmlData.images.image[i]);
ID.push(xmlData.images.image[i].attribute('id'));
caption.push(xmlData.images.image[i].attribute('caption'));
createTileList(i);
}
}
}
catch(er:TypeError){

}
}

No comments:

Post a Comment