Bug 60991 - XPath Extractor : Implement XPath 2.0
Summary: XPath Extractor : Implement XPath 2.0
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 3.2
Hardware: All All
: P2 enhancement (vote)
Target Milestone: JMETER_5.0
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk, PatchAvailable
: 60231 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-04-14 12:46 UTC by Aurélien Dubois
Modified: 2018-06-12 08:53 UTC (History)
2 users (show)



Attachments
Patch implementing feature (81.39 KB, patch)
2018-06-03 15:57 UTC, UbikLoadPack support
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aurélien Dubois 2017-04-14 12:46:47 UTC
Is it possible to make Jmeter compatible with Xpath 2.0 for xpath extractor
Objctive is to use regular expressions in the xpath syntax
Comment 1 Philippe Mouawad 2017-04-19 19:37:20 UTC
Hello,
Thanks for report.
For now the issue seems to be that there is no open source implementation of XPath 2.0 AFAIK.


Regards
Comment 2 Philippe Mouawad 2017-04-22 19:27:16 UTC
Hello,
It seems I didn't read correctly Saxon Homepage.

It appears we may be able to use:
http://saxon.sourceforge.net/#F9.7HE

Mozilla Public License version 1.0 is compatible with ASF License as per :

- https://www.apache.org/legal/resolved.html
Comment 3 UbikLoadPack support 2018-06-03 15:57:51 UTC
Created attachment 35952 [details]
Patch implementing feature

Hello,

UbikLoadPack Team is happy to contribute this enhancement to Apache JMeter developed by Thomas, Anthony and Philippe and sponsored by Ubik-Ingenierie.

Here are the enhancements:

- XPath 2 is now supported relying on SAXON9-HE under MPL 2 license
- A new element has been created to avoid any backward compatibility constraint and to allow cleanup
- A new View Results Tree Renderer has been also implemented
- performances of this component should be significantly faster than old one as XPath Expression are now compiled and cached

We are happy to donate this code to Apache JMeter as we have already donated other piece of code in the past under our signed CCLA.

Regards
UbikLoadPack Team
@ubikloadpack
https://ubikloadpack.com
Comment 4 Aurélien Dubois 2018-06-03 16:29:54 UTC
Thank's a lot Philippe !
Comment 5 Philippe Mouawad 2018-06-03 19:06:20 UTC
Author: pmouawad
Date: Sun Jun  3 19:05:08 2018
New Revision: 1832784

URL: http://svn.apache.org/viewvc?rev=1832784&view=rev
Log:
Bug 60991 - XPath Extractor : Implement XPath 2.0

Contributed by UbikLoadPack
Bugzilla Id: 60991

Added:
    jmeter/trunk/licenses/bin/Saxon-HE-9.8.0-12.txt   (with props)
    jmeter/trunk/src/components/org/apache/jmeter/extractor/XPath2Extractor.java   (with props)
    jmeter/trunk/src/components/org/apache/jmeter/extractor/gui/XPath2ExtractorGui.java   (with props)
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsXPath2.java   (with props)
    jmeter/trunk/src/core/org/apache/jmeter/util/XPathQueryCacheLoader.java   (with props)
    jmeter/trunk/test/resources/XPathUtilTestXml.xml   (with props)
    jmeter/trunk/xdocs/images/screenshots/xpath2_extractor.png   (with props)
Modified:
    jmeter/trunk/LICENSE
    jmeter/trunk/bin/jmeter.properties
    jmeter/trunk/bin/saveservice.properties
    jmeter/trunk/build.properties
    jmeter/trunk/build.xml
    jmeter/trunk/eclipse.classpath
    jmeter/trunk/lib/   (props changed)
    jmeter/trunk/lib/aareadme.txt
    jmeter/trunk/res/maven/ApacheJMeter_parent.pom
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/src/core/org/apache/jmeter/util/XPathUtil.java
    jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml
    jmeter/trunk/xdocs/usermanual/properties_reference.xml
Comment 6 Philippe Mouawad 2018-06-03 19:33:22 UTC
Author: pmouawad
Date: Sun Jun  3 19:13:06 2018
New Revision: 1832785

URL: http://svn.apache.org/viewvc?rev=1832785&view=rev
Log:
Bug 60991 - XPath Extractor : Implement XPath 2.0

Fix failures on SaveService
Bugzilla Id: 60991

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java

Author: pmouawad
Date: Sun Jun  3 19:29:35 2018
New Revision: 1832786

URL: http://svn.apache.org/viewvc?rev=1832786&view=rev
Log:
Bug 60991 - XPath Extractor : Implement XPath 2.0

Fix failures on jars versions testing
Bugzilla Id: 60991

Modified:
    jmeter/trunk/build.properties
    jmeter/trunk/build.xml
    jmeter/trunk/res/maven/ApacheJMeter_parent.pom
    jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java
Comment 7 Philippe Mouawad 2018-06-03 19:38:29 UTC
*** Bug 60231 has been marked as a duplicate of this bug. ***
Comment 8 Philippe Mouawad 2018-06-03 20:13:18 UTC
Author: pmouawad
Date: Sun Jun  3 20:12:49 2018
New Revision: 1832787

URL: http://svn.apache.org/viewvc?rev=1832787&view=rev
Log:
Bug 60991 - XPath Extractor : Implement XPath 2.0

Fix failures on import order
Use isNotEmpty
Ensure context is cleaned up on each call
Bugzilla Id: 60991

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsXPath2.java
    jmeter/trunk/src/core/org/apache/jmeter/util/XPathQueryCacheLoader.java
    jmeter/trunk/src/core/org/apache/jmeter/util/XPathUtil.java
Comment 9 Philippe Mouawad 2018-06-03 20:24:15 UTC
Author: pmouawad
Date: Sun Jun  3 20:23:27 2018
New Revision: 1832788

URL: http://svn.apache.org/viewvc?rev=1832788&view=rev
Log:
Bug 60991 - XPath Extractor : Implement XPath 2.0

Use SaxSource
Bugzilla Id: 60991

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/XPathUtil.java
Comment 10 Philippe Mouawad 2018-06-03 20:36:29 UTC
Tested throughput on attached Test Plan:

1 Thread:

XPath:
Generate Summary Results = 197891 in 00:01:00 = 3289.2/s Avg:     0 Min:     0 Max:     1 Err:     0 (0.00%)

XPath 2:
Generate Summary Results = 582350 in 00:01:00 = 9683.9/s Avg:     0 Min:     0 Max:     1 Err:     0 (0.00%)

5 Threads:

XPath:
Generate Summary Results = 602949 in 00:01:00 = 10014.3/s Avg:     0 Min:     0 Max:     1 Err:     0 (0.00%)


XPath 2:
Generate Summary Results = 2585773 in 00:01:00 = 43000.2/s Avg:     0 Min:     0 Max:     1 Err:     0 (0.00%)


So throughput of new component is 3 to 4 times higher.
Comment 11 Philippe Mouawad 2018-06-12 08:53:31 UTC
Author: pmouawad
Date: Tue Jun 12 08:52:22 2018
New Revision: 1833387

URL: http://svn.apache.org/viewvc?rev=1833387&view=rev
Log:
Bug 60991 - XPath Extractor : Implement XPath 2.0
Update XPath2 Tester so that it's possible to use namespace aliases
Bugzilla Id: 60991

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsXPath2.java
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties