carontony / wicked-good-xpath Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/wicked-good-xpath
Automatically exported from code.google.com/p/wicked-good-xpath
Sorry if this doesn't belong here, but maybe you can help. I have some code
that works on Chrome and Firefox but not on IE (any version as far as I can
tell). Basically, the paths work just fine but the expressions do not. I am not
sure what other information I can provide other than the attached example.
Open a web page, press F12 to open the debugger, go to the script tab, choose
the "Console" tab on the right, and copy-paste the attached code.
"successNodes" has two elements and "success" points to the first; "failNodes"
has no elements and "fail" is null.
Original issue reported on code.google.com by [email protected]
on 1 Mar 2013 at 6:00
Attachments:
More a feature request then a real issue I guess..
Would be nice to get a usage like:
xml.evaluate( etc....
wgxpath.install(window,node)
Original issue reported on code.google.com by [email protected]
on 22 Oct 2012 at 1:54
To reproduce:
1. Open a document with wgxpath loaded and a <div> containing an <svg>
2. wgxpath.install()
3. document.evaluate('//div/svg',document.body).iterateNext()
Expectation: an <svg> element is returned
Result: null is returned
Revision: 21
It seems to be just the child axis which is failing; using the xpath expression
'//div//svg', the expected <svg> element is returned, yet no amount of wildcard
children added ('//div/*/svg', '//div/*/*/svg', etc) produce the same result.
Original issue reported on code.google.com by [email protected]
on 6 Aug 2014 at 3:08
Great library. How to run the tests?
Original issue reported on code.google.com by [email protected]
on 11 Mar 2015 at 6:03
An XPath expression that uses a namespace registered under an other prefix than
in the XML document fail to be evaluated in IE9 and IE10 whereas this works in
Chrome, Firefox and Opera.
The problem was encountered with the r16 but seems to also appear in r17.
In the attached file, I give you an example that reproduce the problem.
Original issue reported on code.google.com by [email protected]
on 7 May 2013 at 2:35
Attachments:
What steps will reproduce the problem?
1. Extract the attached zip file
2. Open the "test.html" file with IE
3. Click on the text box saying "click here"
What is the expected output? What do you see instead?
The expected output if an alert box with the Id of the text box "NOTWorksId",
what I see instead is an error message saying: "Object doesn't support property
or method 'each'"
What version of the product are you using? On what operating system?
Tested with the latest version and the error still occurs
Please provide any additional information below.
It only reproduces on IE8, I added the following tag to reproduce it also on
IE9:
"<meta http-equiv="X-UA-Compatible" content="IE=8" />"
Also, the order in which the scripts are added to the page matter, when
switching them so that "wgxpath.install.js" will be before the "otherScript.js"
it work fine. Unfortunately this is not an option for us.
We deliver some code together with wgxpath as a 3rd party for other sites to
use, some sites have javascript similar to the javascript in the
"otherScript.js" file, so we have no control over it.
You can place a breakpoint in the "filter" method in the "otherScript.js" file
just before the error happens.
Original issue reported on code.google.com by [email protected]
on 11 Feb 2013 at 10:58
Attachments:
My applications get XML documents from HTTPRequest.responseXML and DOMParser.
How difficult is it to extend your solution so that your solution for document
also works on these other objects?
Original issue reported on code.google.com by [email protected]
on 25 Mar 2013 at 8:41
Any namespace qualified step in XPath returns no data.
If "ns:elem1/*" returns elements in the namespace associated with the ns
prefix, then "ns:elem1/ns:*" does not.
Original issue reported on code.google.com by [email protected]
on 3 Apr 2013 at 11:58
What steps will reproduce the problem?
1. Create a document with a prefixed element, i.e. <ns:element>
2. Output the local name of said element, i.e. evaluate("local-name(*)")
What is the expected output? What do you see instead?
The local-name should be "element", regardless of prefix used in the markup.
The local-name returned by wgxpath is "ns:element".
(compare http://www.w3.org/TR/xpath/#function-local-name)
What version of the product are you using? On what operating system?
wgxpath r20, IE11, Windows 7.
Please provide any additional information below.
I already found and test-hotfixed the relevant parts of the code, tho I only
found the minimized version of it to work with.
Compare the 2 XPath functions local-name and name:
V("local-name",3,!1,!0,function(a,b){var c=b?Xa(b.a(a)):a.a;return
c?c.nodeName.toLowerCase():""},0,1,!0)
V("name",3,!1,!0,function(a,b){var c=b?Xa(b.a(a)):a.a;return
c?c.nodeName.toLowerCase():""},0,1,!0)
They are identical. "local-name" shouldn't access the "nodeName" property, but
rather "localName"
(http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-NodeNSLocalN).
When you replace local-name's "nodeName" with "localName", the testcase
outlined above works as expected.
Additionally, selecting a prefixed element fails completely (i.e. evaluating
"/ns:element" on the document above), the relevant code for that seems to be
K.prototype.a=function(a){var b=a.nodeType;return
1!=b&&2!=b?!1:"*"!=this.h&&this.h!=a.nodeName.toLowerCase()?!1:this.c==(a.namesp
aceURI?a.namespaceURI.toLowerCase():"http://www.w3.org/1999/xhtml")};
Changing "nodeName" to "localName" here allows queries of the syntax
"ns:element" to find something. The function looks a little bit too mystical to
say what else this change would cause, so not sure about this one.
Original issue reported on code.google.com by [email protected]
on 8 Apr 2014 at 5:36
Call document.evaluate() on an expression that returns a scalar, but expect a
node to be returned. For example:
document.evaluate("count(//input)", document.documentElement, null, 9);
When using the uncompiled library, an exception is thrown. This is what I would
expect to happen, and what WebDriver expects to happen. When using the
Closure-compiled version of the library, no exception is thrown.
I've attached an HTML file that demonstrates the problem. You can modify the
source of the HTML file to use the compiled or uncompiled version of the
library (adjusting the source paths to your local environment).
Original issue reported on code.google.com by [email protected]
on 13 Sep 2012 at 2:35
Attachments:
The use of an XPath expression with some namespace prefixes doesn't work
anymore in r17. This affects IE9 and IE10.
This concerns prefixes declared in the XML document, not the default namespaces.
The attached file contains an example that reproduces the problem.
Original issue reported on code.google.com by [email protected]
on 7 May 2013 at 2:42
Attachments:
The description stated sootvetsivie documentation W3 (DOM Level 3 XPath), but,
in this case, is entirely absent implementation XPathNSResolver. The plans of
this?
If not, whether you want to open the source code for the private implementation?
Thank you for your work and thank you for any response!
Original issue reported on code.google.com by [email protected]
on 16 Mar 2013 at 4:32
Because the the node lack of a native xml support.
So pure js xml lib on nodejs is very necessary.
The present, xmldom(https://npmjs.org/package/xmldom) can solve most of the xml
parsing problem, but no xpath support.
Original issue reported on code.google.com by [email protected]
on 7 Sep 2012 at 3:15
What steps will reproduce the problem?
1. Run the attached html page on IE, Chrome, FF
2. Notice that the XPath result is different on IE than it is on Chrome/FF
What is the expected output? What do you see instead?
I expect the results on IE to be 'string' but I see nothing.
What version of the product are you using? On what operating system?
Version available on October 8, 2014
Please provide any additional information below.
Thanks.
Original issue reported on code.google.com by [email protected]
on 8 Oct 2014 at 6:52
Attachments:
What steps will reproduce the problem?
1. Create a page and include the script
2. open console and type: !!('evaluate' in document)
3.
What is the expected output? What do you see instead?
result is false should be true. Tested in IE 8,9,10
What version of the product are you using? On what operating system?
Latest 13-09-2013. W7 32 bit
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Sep 2013 at 1:14
What steps will reproduce the problem?
The below standalone example code works in the native implementations of XPath
in Chrome and Firefox but fails with wgx (in IE 11, as well as Chrome and
Firefox if I force them to use wgx).
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
<kml xmlns="http://www.opengis.net/kml/2.2" \
xmlns:gx="http://www.google.com/kml/ext/2.2">\
<Document>\
<Placemark>\
<gx:Track>\
<when>2010-05-28T02:02:09Z</when>\
<gx:coord>7 8 9</gx:coord>\
</gx:Track>\
</Placemark>\
</Document>\
</kml>';
var xmlDocument = new DOMParser().parseFromString(kml, "text/xml");
var namespaces = {
kml : 'http://www.opengis.net/kml/2.2',
gx : 'http://www.google.com/kml/ext/2.2'
};
function namespaceResolver(prefix) {
return namespaces[prefix];
}
var iterator = window.document.evaluate('./kml:Document/kml:Placemark',
xmlDocument.firstChild, namespaceResolver, window.XPathResult.ANY_TYPE, null);
var pm = iterator.iterateNext(); // correct
iterator = window.document.evaluate('gx:Track', pm, namespaceResolver,
window.XPathResult.ANY_TYPE, null);
var track = iterator.iterateNext();
alert(track); //null; should be the track element
What is the expected output? What do you see instead?
The variable "track" should be the gx:Track node in the reference XML, it is
null instead.
What version of the product are you using? On what operating system?
I'm using the build trunk from Oct 3rd. I downloaded
https://code.google.com/p/wicked-good-xpath/source/browse/trunk/build/wgxpath.in
stall.js and am using it as-is.
Win7 x64
Please provide any additional information below.
As I stated, the native implementations work in Chrome and Firefox.
Original issue reported on code.google.com by [email protected]
on 11 Nov 2014 at 10:07
What steps will reproduce the problem?
1.Write and complex expression like
"/DecosReport/Query[@ItemType='DOCUMENT'][@Level='0']/Queries/Query"
2. Try to use document.evaluate(cXPathString, xNode, null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
Function should give snapshotitem? There is not snapshotitem.
I am using IE 11 on windows 8.1.
This is on high priority. Please take a look, thanks in advance.
Original issue reported on code.google.com by [email protected]
on 27 Feb 2014 at 9:42
Attachments:
The library throws error when the element names in xpath has period (.) in it.
To reproduce the problem
1. Create an XML Document with period in element names. Using jQuery you can
create the document using the code
var xml = "<abc><a.d>12</a.d></abc>";
var xmlDoc = $.parseXML(xml);
wgxpath.install();
var result = document.evaluate("/abc/a.d",xmlDoc, null, XPathResult.ANY_TYPE, null);
2. The same script runs on Chrome which provides native support for
document.evaluate but not on IE11 using this library. It fails with an error
SCRIPT5022: Bad token: .
File: wgxpath.install.js, Line: 47, Column: 609
3. I have created a fiddle http://jsfiddle.net/r0gruz30/ which reproduces the
problem. Open the fiddle in chrome and the output will be *Result is 12* but in
IE the output is *Result is* and there is an error in the console
SCRIPT5022: Bad token: .
File: wgxpath.install.js, Line: 47, Column: 609
I am using the latest wgxpath library and seeing the issue on IE11 windows 7.
I debugged the code and found that the reason for the issue is in lexer.js. The
regular expression for _TOKEN does not takes care of periods in element names.
So if I change the regex
wgxpath.Lexer.TOKEN_ = new RegExp(
'\\$?(?:(?![0-9-])[\\w-]+:)?(?![0-9-])[\\w-]+' +
...
.....,
'g')
to
wgxpath.Lexer.TOKEN_ = new RegExp(
'\\$?(?:(?![0-9-\\.])[\\w\\.-]+:)?(?![0-9-\\.])[\\w-\\.]+' +
...
.....,
'g')
it works.
Original issue reported on code.google.com by [email protected]
on 24 Feb 2015 at 10:57
Where can I get the non minified version of this lib?
Original issue reported on code.google.com by [email protected]
on 7 Jan 2014 at 9:50
Is there any plan to add an implementation of XPath Axes? I have found none
that work in IE when using Selenium - which to my knowledge includes
wicked-good-xpath for XPath emulation in IE.
https://developer.mozilla.org/en-US/docs/Web/XPath/Axes
Original issue reported on code.google.com by [email protected]
on 12 Dec 2014 at 6:40
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.