Does anyone do DOM navigation anymore?

Derek Fountain

Usenet Archive
Joined
Jul 17, 2001
Messages
90
Reaction score
0
I've spent the last few days tinkering with DOM trees and the DOM API. A couple of years back I wrote a fairly complex application which found the data it required using this nextSibling, firstChild, sort of navigation. I recall the development experience wasn't a terribly happy one, and I have always presumed that XPATH was largely invented to get past all this mucking about.

So it occurs to me to ask: do people still use the original DOM style navigation? When is it preferable to XPATH? Why, in short, is the whole "document hopping" idea not deprecated?!
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
Derek said:
I've spent the last few days tinkering with DOM trees and the DOM API. A couple of years back I wrote a fairly complex application which found the data it required using this nextSibling, firstChild, sort of navigation. I recall the development experience wasn't a terribly happy one, and I have always presumed that XPATH was largely invented to get past all this mucking about.

So it occurs to me to ask: do people still use the original DOM style navigation? When is it preferable to XPATH? Why, in short, is the whole "document hopping" idea not deprecated?!

DOM contrary to XPath not only allows navigating the document but also changing it (you can add nodes, delete nodes, move nodes etc.). And often you have only a DOM core implementation and no XPath available. Of course if you have XPath on top of or in addition to DOM then it is in most cases easier to navigate to a node with XPath.
 

Andy Dingley

Usenet Archive
Joined
Feb 23, 2000
Messages
3,303
Reaction score
0
Derek Fountain said:
So it occurs to me to ask: do people still use the original DOM style navigation? When is it preferable to XPATH?

XPath returns you a node set, nextSibling returns a node.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top