[XML-SIG] Proposed XPath API

Paul Prescod paul@prescod.net
Tue, 11 Jul 2000 14:11:32 -0500


Here's a start....

import xpath

obj=xpath.compile( "....", nsbindings={prefix:uri,prefix:uri}, **flags ) 

obj.select( node, **flags ) #returns a nodelist
obj.select( nodelist, **flags ) #also returns a nodelist

obj.match( node, **flags  ) #returns a boolean

xpath.select( "...", node, nsbindings={prefix:uri,prefix:uri}, **flags )
#convenience method
xpath.match( "...", node, nsbindings={prefix:uri,prefix:uri}, **flags )
#convenience method

All methods take a **flags parameter as an extension mechanism. For
instance 4XPath would use that to pass in extension functions.

A particular DOM can also provide an optimized XPath engine. The xpath
module will look for  "_xpath_compile", "_xpath_select" and
"_xpath_match" methods on node objects and delegate calls those methods
if they are available. When they are not available, it does the query
"externally".

-- 
 Paul Prescod - Not encumbered by corporate consensus
Simplicity does not precede complexity, but follows it. 
	- http://www.cs.yale.edu/~perlis-alan/quotes.html