[Greasemonkey] Question: XPath on XMLHttpRequests

Aaron Boodman zboogs at gmail.com
Sat Apr 16 11:41:16 EDT 2005


I think Edward was talking specifically about running xpath against
HTML retrieved using XMLHTTPRequest (with the responseText property).

You cannot use any of the normal XML DOM type methods to run xpaths in
this case because you'll just get a malformed xml error.

-- 
Aaron

On 4/16/05, Mark Pilgrim <pilgrim at gmail.com> wrote:
> On 4/16/05, Edward Lee <edilee at gmail.com> wrote:
> > On 4/15/05, Aaron Boodman <zboogs at gmail.com> wrote:
> > > The way I've seen it done is to create an IFRAME then set it's
> > > document.getElementsByTagName("HTML")[0].innerHTML to the
> > > responseText.
> > >
> > > Then you can run xpath's against it's root node.
> >
> > Oh. Very cool ;) Thanks. Would it be possible for me to look at where
> > you've seen it done?
> >
> > _frame.contentDocument.documentElement seems to work.
> 
> See also: http://www.howtocreate.co.uk/tutorials/jsexamples/importingXML.html
> 
> --
> Cheers,
> -Mark
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list