Reading HTML as XML

Hello all,

I am currently trying to read in an HTML page into flash. Basically, HTML is just XML so I should easily be able to parse it, but I am getting this error…

TypeError: Error #1090: XML parser failure: element is malformed.
at InfoBox/::writeStory()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()

It’s reading in the HTML properly (I can trace it out), but I can’t seem to get this function to work properly (fires when a page is loaded):

        function writeStory(event:Event):void
        {
            var storyXML:XML = new XML(event.target.data);
            // other code removed because this is the line that fails...            
        }

Can anyone explain to me why this isn’t working properly for me?

Thanks,

–d