News for hackers. Stuff that matters.
Re:XML: Contrary to popular belief, it doesn't always kill b... by nivertech on Saturday February 19, 2011 @07:03PM (#2240363)
>and XPath == CSS-like selectors with a different set of characters.

I also have a feeling, that jQuery reinvents XPath.

Re:XML: Contrary to popular belief, it doesn't always kill b... by Groxx on Saturday February 19, 2011 @07:09PM (#2240382)
Not if you take jQuery and compare it to XML library X, because that's the actual comparison. XPath == Sizzle, not jQuery - jQuery adds functions to manipulate what the selector returned, which the selector really has no business doing.
Re:XML: Contrary to popular belief, it doesn't always kill b... by nivertech on Saturday February 19, 2011 @09:28PM (#2240754)
What in jQuery is a chain of multiple selectors and filters, can be done using single query in XPath, i.e.

  "document()/html//div[class='title']//img[class='icon']/@src"
Re:XML: Contrary to popular belief, it doesn't always kill b... by Groxx on Saturday February 19, 2011 @09:38PM (#2240775)
I gather you haven't done much jQuery coding. That's equivalent to:

  $("html div.title img.icon").attr("src")
The last .attr("src") is purely because jQuery always deals with a node / a collection of nodes.

You can also do arbitrary attribute searches:

  $("html div[class~='title'] img[src*='google']")
  // "~=" == "contains word" - space-delimited to match html classes
  // "*=" == "contains substring"
http://api.jquery.com/category/selectors/
Re:XML: Contrary to popular belief, it doesn't always kill b... by nailer on Sunday February 20, 2011 @04:14AM (#2241483)
You're right, but jquery doesn't handle XML namespaces. Alas I wish it did.