views:

118

answers:

1

Whenever I load any blogger page through an XML object in actionscript 2 almost all of the contents of the page magically disappear. I would assume that since the pages are in xhtml that this should work. Here is what I get if I try to load Steve Yegge's blog:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.google.com/2005/gml/b" xmlns:data="http://www.google.com/2005/gml/data" xmlns:expr="http://www.google.com/2005/gml/expr"&gt;&lt;head&gt;&lt;script type="text/javascript">(function() { var a=window;function f(e){this.t={};this.tick=function(d,b,c){var i=c?c:(new Date).getTime();this.t[d]=[i,b]};this.tick(&quot;start&quot;,null,e)}var g=new f;a.jstiming={Timer:f,load:g};try{a.jstiming.pt=a.external.pageT}catch(h){};a.tickAboveFold=function(e){var d,b=e,c=0;if(b.offsetParent){do c+=b.offsetTop;while(b=b.offsetParent)}d=c;d</script></head></html>

Scroll to the end and you can see that the entire <body> tag is missing. Any suggestions on how to fix this?

Edit: Here is some quick code so you can test it yourself:

var foo:XML = new XML();
foo.ignoreWhite = true;

foo.onLoad = function(success:Boolean) {
    trace(foo.toString());
}
foo.load("http://steve-yegge.blogspot.com/");
+1  A: 

Well, on quick inspection it looks like your page isn't living up to it's doctype, which is what is probably causing the problem. In general it doesn't look like it's valid XML, which is why ActionScript is choking on it. I just did a quick test with another XHTML strict page that does validate and I was able to scrape through the full node structure without a problem.

If you can't fix the markup, you may want to look into the onData event of the AS2 XML class - it lets you grab the raw data prior to parsing. That may let you pull out the content you need in a different manner.

Branden Hall
The page I was using as an example wasn't mine its another programmer's blog.
Anton