[XML-SIG] Proposed XPath API

Mike Olson Mike.Olson@fourthought.com
Tue, 11 Jul 2000 16:08:18 -0600


Paul Prescod wrote:
> 
> 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

I think these will have to be 2 different objects.  In XPath the
difference is Path vs expression.  Its a matter of where you start in
the EBNF.  A path is used to select, and an expression is used to
match.  What about"

obj = xpath.compilePath(....)
obj.select(...)

and 

obj = xpath.compileExpression(....)
obj.match(....)

> 
> 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".

Do we want to do this, or hold off a bit till DOM III and things like
PAX are finalized?  


Mike

> 
> --
>  Paul Prescod - Not encumbered by corporate consensus
> Simplicity does not precede complexity, but follows it.
>         - http://www.cs.yale.edu/~perlis-alan/quotes.html
> 
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://www.python.org/mailman/listinfo/xml-sig

-- 
Mike Olson				 Principal Consultant
mike.olson@fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python