actionscript中的XML加载

时间:2009-11-30 15:03:35

标签: xml actionscript rss

我正在尝试使用adobe文档中的基本XML解析代码。

我尝试了几个我计划使用的RSS源,很多大型网站..

一个工作,其他人返回状态-10,状态:-10(遇到没有匹配的开始标记的结束标记。)

事实是,这些都是大型网站,他们的所有供稿都没有变形......

此外,我简要检查了XML结构,并使用XML语法检查器(Notepad ++)进行了检查,结果正确..

那么为什么flash会将这些视为畸形呢?我怎么解决呢?

http:// rotter.net/rss/rotternews.xml

这不起作用,而其他网站也不行,其他一些链接也能正常工作。

我取得了一些进展,我发现加载这个rss url,

通过浏览器获取正确的内容,但是当我在Orbit下载管理器中尝试时,我只得到六个字节!

</rss>
也许这就是flash看到的那个?

这可能是我获得部分内容的原因?

请帮忙......



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 terminated.";
        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");

0 个答案:

没有答案