Bug 5576 - XPath query fails with "is not object"
Summary: XPath query fails with "is not object"
Status: RESOLVED DUPLICATE of bug 6638
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 10489
  Show dependency treegraph
 
Reported: 2005-10-31 12:30 PST by Michiel Roding
Modified: 2006-08-18 16:47 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michiel Roding 2005-10-31 12:30:31 PST
I've been trying to use XPath in both the nightly Safari and the stable release; and it just won't work; any 
clearity on how to use, if usable, XPath in Webkit would be appreciated.

A sample document; which works in Firefox and Camino;

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
	<title>Safari XPath test</title>
	<style>
	.bla { border: 1px solid red;}
	</style>
</head>
<body>
	<dl>
		<dt>lorem</dt>
		<dd>ipsum</dd>
		<dd>another one</dd>
		
		<dt>next</dt>
		<dd>follow-up</dd>
	</dl>
	<script>
		var iterator = document.evaluate("/html/body", document, null, 0, null);
		
		while(item = iterator.iterateNext()) 
		{
			item.className = 'bla';
		}
	</script>
</body>
</html>

No matter what XPath query I used (I was trying //dl/dt[1]/following-sibling::dd[1]) - always get the 
error:
TypeError: value undefined (result of expression document.evaluate) is not object.
Comment 1 Paul Everitt 2005-12-02 06:45:05 PST
I asked in IRC and found out that XPath evaluation isn't claimed to work.  IIRC, it also isn't 
on the near-term radar either.

That's too bad, as I could really use this facility.
Comment 2 Joost de Valk (AlthA) 2005-12-27 01:28:03 PST
Confirmed on request of Paul Everitt.
Comment 3 Eric Seidel (no email) 2005-12-27 01:58:52 PST
Folks on the KDE side, in the library KDOM (which stems from a very similar code base to WebCore) 
already have two working xpath implementations.  One for 1.0 and a partial one for 2.0.  It's possible that 
someone could port one of these into WebCore with relatively minimal effort.
Comment 4 Jesse Costello-Good 2006-01-17 20:36:09 PST
I am evaluating Safari for a port of TIBCO(R) General Interface, a mature AJAX platform that is currently IE 
only. Fixing this bug would make the port more feasible. 
Comment 5 Anders Carlsson 2006-05-08 14:28:32 PDT

*** This bug has been marked as a duplicate of 6638 ***