Xpath 2.0 online Checker - xpath

Is there any plugin or software where i can check the functions of Xpath 2.0 ??
Currently i am using Xpath Checker (ff Plugin) which only supports Xpath 1.0.

There is an online XPath 2.0 tool called PathEnq that might suit.
The tool runs client-side by using the Saxon-CE XSLT 2.0 processor (a JavaScript application) as a 'host' and dynamically generating XSLT based on your expression. XPath variables and namespaces are supported.

I'm using online xpath tester xpather which works really nice.
Note: It's xpath 2.0 support is currently in beta.

Related

Jasper Reports use Xpath functions

We are using Jasper Report's xml datasource. To create some output, we would need the XPath distinct-values() function, as described. If I use it like described, Jasper Studio gives me an error:
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDa‌​taSource("distinct-values(/connections/message/type)")
Does anyone know how to use XPath functions in Jasper Reports, jrxml files?
distinct-values() is a function that is exclusive to XPath 2.0. Unfortunately, Jasper Reports only support XPath 1.0 (ironically, the forum post is about exactly the same thing).
The short answer is: no, there is no XPath 1.0 function that eliminates duplicate values from a set of nodes.
There might be ways around this problem, if you can show more of your input XML document.
EDIT: For the record, here is the answer the OP got from the Jasper Reports Forum:
Hi, I talked with JR Team in order to better clarify the topic. So currently the version supported is XPath version 1.0. This because JR relies on Xalan or Jaxen for XPath support. These thirdy-part libraries currently support version 1.0.
Looking at the Jaxen FAQ it seems to be a "strict" decision they made, focusing only on compatibility support: http://jaxen.codehaus.org/faq.html
Which version of XPath does jaxen support? Does jaxen support XPath 2?
jaxen supports XPath 1.0. It does not support XPath 2.0. XPath 2.0 is a very different spec with many things to recommend it and a few things not to like as well. However XPath 2.0 is not compatible with XPath 1.0. It is far from a simple upgrade from XPath 1.0. It has a very different data model, that might well require significant revisions to jaxen's internal data structures, and possibly a very different API as well.
The current release plan focuses exclusively on XPath 1.0 compatibility. Perhaps one day someone will make a branch or fork of jaxen that supports XPath 2. However, this would be a significant undertaking, and so far little interest in this has been shown.
Therefore for the moment we will stay with version 1.0 of XPath
I disagree with the "a few things not to like" about XPath 2.0, but it is a clear answer, at least.

An example using EXSLT func:script in Firefox

Can anyone point me to an actual complete example of using EXSLT func:script in a xslt file that works on Firefox (so if my XML file had a xml-stylesheet instruction it would transform the xml file into HTML using an external js file)?
Thanks in advance.
That is not possible as the XSLT processor implementation in Mozilla/Firefox does not support that EXSLT feature. The only EXSLT features supported by Mozilla are listed on https://developer.mozilla.org/en-US/docs/EXSLT.

Difference between "System.Linq.Dynamic", "Dynamic Expression API" and "DynamicLINQ" on NuGet?

I noticed that there are 3 versions with the same functionality available on NuGet ?
System.Linq.Dynamic (Microsoft)
Dynamic Expression API (Microsoft)
DynamicLINQ (David Fowler)
Can someone explain the differences ? And which one is the best package to use ?
The only difference is that Dynamic Expression API (DynamicQuery) supports .NET 3.5 and System.Linq.Dynamic also supports .NET 4.0
The DynamicLinq package has a totally different usage and API.

xpath-locator plugin in firefox

Is xpath-locator plug-in for Firefox can help in locating the elements in selenium script.
Any limitation using this plug-in in script?
It's always better to create your own xpath using firebug, firepath (a firebug extension) , webdeveloper or any other tool. You will learn to create xpaths which are not brittle. :)
Your question is very generic. It is not possible to cover all or at least the most variants of dynamically generated HTML source code to find elements by just using Xpath or CSS selectors. You will need a more "intelligent" logic.
If you tell us what your exact task is, we may help you with a solution for your problem.

Can I use xpath 2.0 with firefox and selenium?

I saw other questions referring to xpath 2.0, which apparently simplifies string expressions. I'm using Firefox 3.5.5 and selenium 1.0.1.
How can I check if my versions of Firefox and Selenium support it?
Does Selenium defer to Firefox's built-in Xpath implementation?
In that case, if I start using another (perhaps older) browser with selenium, will I run into problems by expecting xpath 2.0?
By default, selenium uses the "native" version of XPath that comes with the browser. You can make it use a version that comes with Selenium, written in JavaScript. This seems to implement XPath 1.0, based on glancing at the source.
I think there is a jQuery plugin that gives you support for XPath 2.0. So, theoretically, if you inject jQuery and the plugin into your browser, maybe you could call XPath 2.0 commands with a JavascriptExecutor. Really, its probably not necessary though, but might be fun to play with.
Currently no browsers support XPath 2.0. To allow the use of a version that comes with Selenium, written in JavaScript, as suggested by #paul-biggar, use the following command :
allowNativeXpath(false)
more informations here :
http://www.seleniumwiki.com/software-testing/selenium-ide-allownativexpath/

Resources