Talk:XPath

From MozillaZine Knowledge Base
Revision as of 18:02, 29 March 2005 by Jgraham (talk | contribs) (HTML is not XML)
Jump to navigationJump to search

asquella, why did you write 'Note that you shouldn't use this function if you expect to get a long list of results from it.' --grimholtz

That function copies query results to an array, taking additional memory and CPU cycles. I wouldn't use it at all, but for simple queries I think that simpler interface is worth the overhead. (Not that I've done any profiling.)
Related example (though not completely applicable): try opening JS Console when it has a lot of entries asqueella


So this page is actually a bit misleading in that it suggests that you can only use XPath with XML - infact it will work with any DOM tree. I'm also not sure that making use of a helper function actually helps people understand what's going on (but then I should finish my documentation...) --Jgraham 03:20, 20 Mar 2005 (PST)

DOM trees are in-memory representations of XML. They are one and the same, so I don't see how this can be misleading.
HTML is not XML but HTML has a DOM and XPath works with HTML ~~