XPath 2.0 online tester? [closed]
Asked Answered
S

3

15

i work with Oxygen XMLTester for xPath selectors, supporting XPath 2.0 specification. So i wonder if there is any online tester working with XPath 2.0 spec.? http://www.xmlme.com/XpathTool.aspx[http://www.xmlme.com/XpathTool.aspx][2] http://www.xpathtester.com/test[http://www.xpathtester.com/test][3]

Those above-mentioned testers failed to take the following XPAth (2.0 rather succeded):/list/sum(item/prices/price[@currency='USD']) with XML:

<list>
   <item new='true'>
     <title lang="en">Pop-Music DVD</title>
     <author >K. A. Bred</author>
     <year>2012</year>
     <prices>
       <price currency="USD">29.99</price>
       <price currency="EUR">23.2</price>
     </prices>
   </item>
   <item new='false'>
    <title>Gone with the wind</title>
    <author>M. Mitchell</author>
    <year>1936</year>
    <prices>
      <price currency="USD">19.05</price>
      <price currency="EUR">15</price>
    </prices>
  </item>
</list>
Sublingual answered 9/7, 2012 at 8:2 Comment(2)
Disagree that asking to find a tool should be off-topic. These sorts of questions and their answers can be incredibly useful.Squireen
useful, undoubtedly...but that doesn't make them on-topic!Mesocratic
V
30

Since this bubbled up again:

I also made a XPath 2.0 online tester here.

Not so colorful or descriptive, but IMHO easier to use for small queries.

Verdaverdant answered 5/10, 2012 at 23:36 Comment(13)
Fine, except for the fact that it's not XPath 2.0 - I think you should make that clear.Herein
@pgfearo: What? No, it supports all of XPath 2.0. If there is something it does not support it is a bug, and I will fix it. (or I have already fixed it and just not uploaded, like support for unsigned 64 bit ints or node-name(@attrib).). (at least for now, I'm currently implementing XQuery and then I want to add XPath 3.0, so it might support XPath 3.0 in a few months)Verdaverdant
This is good work, but look up the term 'pseudo' which you're using on your site - it does not give the impression that you're even trying to follow the specification. Be more explicit also about restrictions and extensions - and as a starter, add support for namespaces - even XPath 1.0 supports namespaces.Herein
@pgfearo: well, when I made the first version of that webpage years ago, it only supported half of XPath 1. And then I have never bothered to update the front end, when I updated the back end. Perhaps I should, but I didn't think anyone would care anyways... And at the bottom of the page are some links to a pasdoc file (that is like javadoc) that lists the major differences. (and it is supposed to be a library for html not xml, in html namespaces are seldom used )Verdaverdant
Thank you for the XPath 2.0 tester! Great little tool, helped me a lot.Squireen
Thanks! It worked fine for my needs (html that wouldn't pass strict xml testing)Infra
@LarsH: There are no differences for XPath 2.0 anymore in the compatibility mode (at least my code, there are still some issues in the used regex engine and XML parser). namespace:: is an XPath 3.0 feature. Actually, namespace:: and the format-* functions are the only XPath 3.0 features it still lacks. Anyways, this was the pasdoc file.Verdaverdant
The namespace axis was an XPath 1.0 feature (w3.org/TR/xpath/#axes), but you're right that it's not a required part of XPath 2.0. Thanks, I was not aware of that.Isia
However, namespace:: is not an XPath 3.0 feature -- it's just as deprecated in 3.0 as in 2.0. (w3.org/TR/xpath-30/#id-basics)Isia
Then I confused it with the namespace-node test. (I only know the things I have already implemented)Verdaverdant
Great tool, almost perfectRockabilly
@Verdaverdant Something is wrong: puu.sh/Dfsz6/0ed3e12581.png. It is giving too many results.Hundredfold
@dafie: looks as it is repeating parts of output lines 12 to 15. perhaps the merging of the xpath output with the surrounding webpage fails (recently I changed the output buffer, previously it wrote everything on stdout). Does it happen often? I cannot reproduce itVerdaverdant
H
5

There's now an online XPath 2.0 tester/analyser at:

http://www.qutoric.com/xslt/analyser/xpathtool.html

This actually runs using the Saxon-CE XSLT 2.0 processor under the covers (the app was written in XSLT 2.0). Screenshot showing your expression evaluated:

enter image description here

Herein answered 5/10, 2012 at 22:43 Comment(3)
Both answers satisfy me for now.Sublingual
This is good, although there doesn't seem to be a way to type or paste XML in the browser... it seems that you have to have it in a file. Or am I missing something? Anyway, using Saxon-CE is a great idea, as it gives you a very good quality XSLT/XPath engine in the browser.Isia
You're right, there's no way to add/edit XML in any other way than from a pre-existing file. I wanted to avoid writing another XML editor from scratch (once was enough!) but it could someday be integrated with one of the existing browser-based code editors.Herein
G
1

Here I found useful one more interactive xpath tester.

Garlicky answered 6/7, 2013 at 6:50 Comment(1)
+1 because it works with HTML (Great if using Scrapy)Intisar

© 2022 - 2024 — McMap. All rights reserved.