Here is how the XPath spec [1] describes it:

//para selects all the para descendants of the document root and thus selects all para elements in the same document as the context node

So, para, or in your case, hooks, would need to be a descendant of the document root. Since hooks is the document root, it doesn't work.


[1] http://www.w3.org/TR/xpath#path-abbrev


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Sep 12, 2007, at 3:06 PM, Giant Jam Sandwich wrote:


Hi Karl,

<hooks> is the root element. I just assumed that the double forward
slash, which is supposed to find an element from any position within
the DOM, would naturally start at the root node. Is that a wrong
assumption?

Thanks.

Brian


On Sep 12, 9:03 am, Karl Swedberg <[EMAIL PROTECTED]> wrote:
Hi Brian,

Is <hooks> the root element of your XML file? If so, then I think it
makes sense that /hooks works while //hooks doesn't.

--Karl
_________________
Karl Swedbergwww.englishrules.comwww.learningjquery.com

On Sep 12, 2007, at 9:39 AM, Giant Jam Sandwich wrote:





This however does work:

$("/hooks/errors/error",data);

Although they mean two different things, this will be sufficient for
what I am doing. It might still be good to look into though.

Thanks John.

On Sep 11, 4:18 pm, "John Resig" <[EMAIL PROTECTED]> wrote:
What version of jQuery - and if you're using jQuery 1.2, do you have
the XPath plugin included?

--John

On 9/11/07, Giant Jam Sandwich <[EMAIL PROTECTED]> wrote:

$("//hooks/errors/error",data);

If my XML contains an error node, everything is okay. If it does not
contain an error node, I get the following error:

"Error: d[i].getElementsByTagName is not a function"

Shouldn't it just return null?

Thanks.

Brian- Hide quoted text -

- Show quoted text -


Reply via email to