S9APIXpath and namespaces and variables

View: New views
2 Messages — Rating Filter:   Alert me  

S9APIXpath and namespaces and variables

by robertsmme :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
 I am trying to improve performance of my app by using the saxon API on JDOM documents rather than JAXEN.
 
  In the process I have a number of questions?
 
  1) Do I need to explicitly set up namespace context?
  2) If I do when should I do it?  Can it be done before the load of the compiled xpath?
  3) When do I set up variables? Can I do this before the load()?
 
  The reason for wanting to do this before the load is that I want to reduce the amount of setup for each new XPATH as I have literally hundreds to process against the same document with the same namespace and variable contexts?
 
Martin

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

Re: S9APIXpath and namespaces and variables

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Namespaces and variables both need to be declared (on the XPathCompiler) before the XPath expression is compiled. You can reuse the XPathCompiler to compile many XPath expressions, and its state (including declared variables and namespaces) is retained between compilations.
 
Value for variables need to be set up on the XPathSelector before the expression is evaluated. You can reuse the XPathSelector (and it retains the variable values) provided that you don't try to use it concurrently in different threads.
 
Hope this answers the question!
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@... [mailto:saxon-help-bounces@...] On Behalf Of martin.me.roberts@...
Sent: 15 July 2008 15:26
To: saxon-help@...
Subject: [saxon] S9APIXpath and namespaces and variables

Hi,
 I am trying to improve performance of my app by using the saxon API on JDOM documents rather than JAXEN.
 
  In the process I have a number of questions?
 
  1) Do I need to explicitly set up namespace context?
  2) If I do when should I do it?  Can it be done before the load of the compiled xpath?
  3) When do I set up variables? Can I do this before the load()?
 
  The reason for wanting to do this before the load is that I want to reduce the amount of setup for each new XPATH as I have literally hundreds to process against the same document with the same namespace and variable contexts?
 
Martin

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 
LightInTheBox - Buy quality products at wholesale price