toXML() fails to parse html strings

toXML() fails to parse html strings

I want to write a function in that extracts some content from an external html file. I saw an explanation on how to do this, basically: mapvar = getUrl(<URL>, false); stringdata = mapvar.get("responseText"); x = stringdata.toXML(); ... now parse data in x as XML ... However for anything but a trivial html page, the toXML() call fails with "Unable to update variable x". e.g. fails for http://www.google.com. Am I missing something? If nothing can be done about this, what other utilities can I use to easily parse the html content in stringdata? i.e. something with good regular expressions support. Thanks.