January 12, 2006

Do you generate XPaths? (Or need to?)

I've been thinking for a while about implementing a "XPath Generator" in Firefox, SeaMonkey, etc. I'd like to see it implemented in mainstream Mozilla, but I need evidence to show that people do need this.

So if you have any algorithms which generate XPaths for your web page, application, tool, etc., please explain how you would use it under the "Potential Use Cases" section. Also, if you see yourself using a feature like this, please say so, and how.

I also invite you to take a look at the spec in general, and offer general commentary on the Discussion tab. I am taking your comments seriously, and will update the main page accordingly.

Posted by WeirdAl at January 12, 2006 6:12 PM
Comments

I do not generally use XPath, but that is because I never dived into its syntax. I see XPath' value and if there would be a generator it would make it easier for people to use XPath queries.

Some XPath-'prior art' for Firefox:
XPath Checker: http://slesinsky.org/brian/code/xpath_checker.html

XPath Expressions Editor 2
"This is a GUI style editor, assists to creating XPath expressions."
http://piro.sakura.ne.jp/xul/xul.html.en
http://piro.sakura.ne.jp/xul/applications/xpath2/ (only in Japanese ?)

I hope those examples help with deciding what to do with XPath in Mozilla and that other people have some nice use cases for it.

Posted by: Martijn at January 12, 2006 10:40 PM

And another one:
XPather: http://xpath.alephzarro.com/index

(Sorry for the spam)

Posted by: Martijn at January 12, 2006 10:41 PM

I've got a bookmarklet that gives you the XPath query for a specific document, so I can use it in my userContent.css. I believe there is also an extension for it, but I don't remember offhand. Your proposal sounds useful to me, but WDIK of the Mozilla innards?

Posted by: Jan! at January 13, 2006 1:57 AM

My annozilla extension (http://annozilla.mozdev.org/) is a client for the W3C's Annotea server, which uses XPointers. I guess that XPointer generation/resolution would be easier with build-in XPath support.

Posted by: Matthew Wilson at January 13, 2006 5:34 AM

A related thought: I'd like to see an extension of the fragment identifier to support XPath. Something like:

foo.html#!xpath!<xpath-path>

(The ! syntax is based on that I used for link fingerprints). Legacy browsers would ignore the identifier and go to the top of the page.

Gerv

Posted by: Gerv at January 14, 2006 2:28 PM

Alex Furman's app IE Automation (http://www.alexfurman.net/) used XPATH to identify HTML objects. It would be quicker and easier to map objects from a simple app/toolbar like you have in mind.

Posted by: Brent Strange at January 18, 2006 10:18 AM

I was trying to develope a DOM Event recorder/playback system, and had to write an xpath generator for that. It seems to me a standard xpath generator would be a good idea. The interface seems to cover what I would need.

Posted by: Shane Caraveo at January 18, 2006 11:28 AM