XPath 2.0 online tester?

20,180

Solution 1

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.

Solution 2

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

Solution 3

Here I found useful one more interactive xpath tester.

Share:
20,180
Igor Savinkin
Author by

Igor Savinkin

I work in web scraping field. I do also tech copy writing and webscraping.pro blog editing. Welcome to directly contact me by email (igor [dot] savinkin [at] gmail [dot] com) for web scraping and data protection issues. Also contact me if you are interesting in copy writing or blog guest posting.

Updated on August 01, 2020

Comments

  • Igor Savinkin
    Igor Savinkin almost 4 years

    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>
    
  • pgfearo
    pgfearo over 11 years
    Fine, except for the fact that it's not XPath 2.0 - I think you should make that clear.
  • BeniBela
    BeniBela over 11 years
    @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)
  • pgfearo
    pgfearo over 11 years
    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.
  • BeniBela
    BeniBela over 11 years
    @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 )
  • Igor Savinkin
    Igor Savinkin over 11 years
    Both answers satisfy me for now.
  • vikingsteve
    vikingsteve over 10 years
    Thank you for the XPath 2.0 tester! Great little tool, helped me a lot.
  • Henry
    Henry about 10 years
    Thanks! It worked fine for my needs (html that wouldn't pass strict xml testing)
  • FloatingRock
    FloatingRock about 10 years
    +1 because it works with HTML (Great if using Scrapy)
  • BeniBela
    BeniBela over 8 years
    @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.
  • LarsH
    LarsH over 8 years
    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.
  • LarsH
    LarsH over 8 years
    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)
  • BeniBela
    BeniBela over 8 years
    Then I confused it with the namespace-node test. (I only know the things I have already implemented)
  • LarsH
    LarsH over 8 years
    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.
  • pgfearo
    pgfearo over 8 years
    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.
  • Zoran
    Zoran over 6 years
    Great tool, almost perfect
  • dafie
    dafie about 5 years
    @BeniBela Something is wrong: puu.sh/Dfsz6/0ed3e12581.png. It is giving too many results.
  • BeniBela
    BeniBela about 5 years
    @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 it