You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Chris Macomber <cm...@sapient.com> on 2000/07/23 10:18:25 UTC

Query DOM for list of nodes help

Hi,
	I'm attempting to query a DOM Document object (or Node object) using
an expression similar to an XSL template matching expression (ie.
/xml/table[@name='value']), but I can not find the functionality in the
xerces or xalan packages to do this.  I've used the Microsoft parser which
has a selectSingleNode function where you pass it an expression like the one
above and it returns a NodeList (since more than one node can match).  I'm
sure these packages have this functionality as well, but I can't find it.
Please help or point me to an example.

Chris

P.S. I've seen the getElementsByTagName function, but that seems to simply
take a name of node and find everything in the DOM.  I need something more
specific like the above expressions where I can add context to the result
set.

RE: Query DOM for list of nodes help

Posted by Ed Staub <es...@mediaone.net>.
Query DOM for list of nodes helpChris,

Xalan provides this capability; it includes an XPath pattern matcher
See http://xml.apache.org/xalan/usagepatterns.html#xpath.

-Ed Staub
  -----Original Message-----
  From: Chris Macomber [mailto:cmacomber@sapient.com]
  Sent: Sunday, July 23, 2000 4:18 AM
  To: 'xerces-j-dev@xml.apache.org'
  Subject: Query DOM for list of nodes help


  Hi,
          I'm attempting to query a DOM Document object (or Node object)
using an expression similar to an XSL template matching expression (ie.
/xml/table[@name='value']), but I can not find the functionality in the
xerces or xalan packages to do this.  I've used the Microsoft parser which
has a selectSingleNode function where you pass it an expression like the one
above and it returns a NodeList (since more than one node can match).  I'm
sure these packages have this functionality as well, but I can't find it.
Please help or point me to an example.

  Chris

  P.S. I've seen the getElementsByTagName function, but that seems to simply
take a name of node and find everything in the DOM.  I need something more
specific like the above expressions where I can add context to the result
set.