XML load in actionscript
I am trying the basic XML parsing code from the adobe documentation..
I tried it with several RSS feeds I plan to use, many of large websites..
one worked, the others returned status -10, status: -10 (An end-tag was encountered without a matching start-tag.)
the thing is, these are big sites, there is no way all of their feeds are malformed...
plus, I checked briefly the XML structure, and checked it with an XML syntax checker (Notepad++) and it came out correct..
so why is flash treating these as malformed ? how can I solve it ?
http:// rotter.net/rss/rotternews.xml
this doesn't work, and other don't as well from other sites, some other links do work.
I made some progress, I found that loading this rss url,
via a browser gets me the right content, but when I try it in Orbit download manager, I only get six bytes! which are
</rss>
maybe this is what flash sees as well ?
what could be the reason for me getting only partial content ?
please help...
var my_xml:XML = new XML();
my_xml.onLoad = function(success:Boolean) {
if (success) {
if (my_xml.status == 0) {
trace("XML was loaded and parsed successfully");
} else {
trace("XML was loaded successfully, but was unable to be parsed.");
}
var errorMessage:String;
switch (my_xml.status) {
case 0 :
errorMessage = "No error; parse was completed successfully.";
break;
case -2 :
errorMessage = "A CDATA section was not properly term开发者_StackOverflow社区inated.";
break;
case -3 :
errorMessage = "The XML declaration was not properly terminated.";
break;
case -4 :
errorMessage = "The DOCTYPE declaration was not properly terminated.";
break;
case -5 :
errorMessage = "A comment was not properly terminated.";
break;
case -6 :
errorMessage = "An XML element was malformed.";
break;
case -7 :
errorMessage = "Out of memory.";
break;
case -8 :
errorMessage = "An attribute value was not properly terminated.";
break;
case -9 :
errorMessage = "A start-tag was not matched with an end-tag.";
break;
case -10 :
errorMessage = "An end-tag was encountered without a matching start-tag.";
break;
default :
errorMessage = "An unknown error has occurred.";
break;
}
trace("status: "+my_xml.status+" ("+errorMessage+")");
} else {
trace("Unable to load/parse XML. (status: "+my_xml.status+")");
}
};
my_xml.ignoreWhite = true;
my_xml.load("http://rss.walla.co.il/?w=/6/4002/0/@rss");
加载中,请稍侯......
精彩评论