[ 
https://issues.apache.org/jira/browse/CAMEL-4759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173141#comment-13173141
 ] 

Raul Kripalani commented on CAMEL-4759:
---------------------------------------

Patch attached. Users can now specify Saxon in three different ways in the 
<xpath /> Spring DSL element:
* saxon=true
* objectModel="http://saxon.sf.net/jaxp/xpath/om";
* factoryRef="ref to the bean of type XPathFactoryImpl"

saxon=true is a shortcut for setting the objectModel to the above value.
Added new logic to obtain the XPathFactory based on the objectModel URI on a 
per-instance basis. This was only being used to obtain the 
"defaultXPathFactory" which is set as a static field in the XPathBuilder.

Added a number of test cases to validate the changes. During initialisation, 
the XPathFactory system variable is set to force the JRE to use the platform 
default (Xalan), since having Saxon in the classpath will make the JRE pick it 
up due to Service Provider discovery. This does not happen in OSGi because the 
META-INF/services directory of the Saxon bundle is not exported (as Service 
Provider mechanism clashes with OSGi).

Also, added a toString() representation to DefaultNamespaceContext and a new 
log statement printed on TRACE level whenever a new XPath Expression is added 
to the pool, which also shows the Namespace context.

                
> Balance up xpath XML element with Java DSL equivalent
> -----------------------------------------------------
>
>                 Key: CAMEL-4759
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4759
>             Project: Camel
>          Issue Type: Sub-task
>          Components: camel-core, camel-saxon
>    Affects Versions: 2.8.4, 2.9.0
>            Reporter: Raul Kripalani
>         Attachments: xpathBalancingAndNamespaceLogging.diff
>
>
> The <xpath> XML element in Spring DSL doesn't allow to set the following 
> options which are available on Java DSL:
> * factory
> * object model
> * shortcut to use Saxon
> These options should be implemented as attributes on the xpath XML element, 
> e.g.:
> {code}
> <xpath factory="net.sf.saxon.xpath.XPathFactoryImpl">...</xpath>
> {code}
> {code}
> <xpath objectModel="http://saxon.sf.net/jaxp/xpath/om";>...</xpath>
> {code}
> (this one somehow feels ugly, is the objectModel supposed to be a namespace?)
> {code}
> <xpath saxon="true">...</xpath>
> {code}
> Only one should be allowed at a time.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to