[Greasemonkey] XPath Resources
Lenny Domnitser
ldrhcp at gmail.com
Wed Sep 27 21:57:15 EDT 2006
On 9/27/06, Brendan J <verifex at gmail.com> wrote:
> I'm looking for some good resources on using the sleek & sexy XPath stuff in
> JS on GM. I've seen alot of scripts use it, and I have seen that it uses
> some kind of wacky regular expression system to find items in the DOM tree.
> But most of the references I have found online are for using it on XML, so
> I'm looking for references that use it in relation to HTML.
As you said, XPath is for selecting nodes from the DOM, so once a DOM
is built, it doesn't matter if it's for XML or HTML. You can learn the
XPath syntax from XML tutorials and apply it to HTML.
The only thing you should know is that when Mozilla builds a DOM for
HTML, there is a little bit of voodoo in what the tree ultimately
looks like. To help, you can use the DOM Inspector that is bundled
with Firefox, and the XPather extension
<http://xpath.alephzarro.com/>.
More information about the Greasemonkey
mailing list