# Reading HTML as XML

**URL:** https://forum.kirupa.com/t/reading-html-as-xml/231672
**Category:** Uncategorized
**Created:** [July 6, 2007, 3:25pm UTC](https://forum.kirupa.com/t/reading-html-as-xml/231672 "2007-07-06T15:25:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dewey](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@dewey](https://forum.kirupa.com/u/dewey)
#### Post date: [July 6, 2007, 3:25pm UTC](https://forum.kirupa.com/t/reading-html-as-xml/231672/1 "2007-07-06T15:25:01Z")

</div>

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](http://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):

```auto
        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
