Xpath and DOM

Hunter, David dhunter at Mobility.com
Wed Dec 15 04:48:03 GMT 1999


This may or may not be what you're looking for, but the DOM included with
Internet Explorer 5, MSXML, allows you to enter an XPath expression as a
parameter to the selectNodes() and selectSingleNode() methods.

(Actually, it's not *real* XPath.  It's based on a note submitted to the W3C
for XQL, as memory serves.  [It usually doesn't.]  But it's pretty durned
close, and when the next MSXML is released which is slated to have full 100%
compliant XSL support, I'm assuming it will have full 100% compliant XPath
support as well.)

-----Original Message-----
From: Leigh Dodds [mailto:ldodds at ingenta.com]
Sent: Tuesday, December 14, 1999 8:32 AM
To: xml-dev
Subject: Xpath and DOM


At present the DOM spec only allows one to traverse the 
tree 'manually' using getChild, etc. Or jump into the 
tree at some point using getElementsByTagName.

Theres nothing in there to allow me to do getElementsByExpression
(accepting an XPath search expression), or similarly pull out 
sections of the DOM tree using XPath expressions.

I've written basic utilities to do this, as have others I'm sure 
(XSLT engines must use something similar), but I'm curious as to when, or 
even whether, this type of feature is going to be added to the 
DOM API itself. 

It would seem to be pretty useful. In the applications I've built 
so far, I've not wanted to traverse or walk the tree, just pick 
out bits of it (and sure I could use SAX but I want the tree 
in memory because I'm manipulating it multiple times).

Unless I'm asking the wrong question - is there a tool that will 
search a DOM tree for me, assuming I supply it with an XPath 
expression.

Cheers,

L.

==================================================================
    "Never Do With More, What Can Be Achieved With Less"
				---William of Occam
==================================================================
Leigh Dodds                             Eml:  ldodds at ingenta.com
ingenta ltd                             Tel:  +44 1225 826619
BUCS Building, University of Bath       Fax:  +44 1225 826283

eclectic				http://weblogs.userland.com/eclectic
homepage				http://www.bath.ac.uk/~ccslrd
==================================================================


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN
981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list