Closed GoogleCodeExporter closed 9 years ago
Could you provide the full html you used for the test? It seems that you are
using document.evaluate on IE. I assume you've included wicked-good-xpath?
Also, the library didn't fully support XML documents, but we can take a look at
it.
Original comment by zhoumoto...@gmail.com
on 2 Mar 2013 at 2:10
Here are all of the files in a ZIP. I commented out the parts that would
actually retrieve the XML and just hardcoded it. It should fail on page load. I
didn't comment out the stuff around the button, but if you press it, it will
just redirect you somewhere.
Because it works just fine in FF and Chrome, I suspect this is something wonky
that IE is doing. Thank you for taking the time to look into it.
Original comment by John.Pau...@gmail.com
on 4 Mar 2013 at 3:37
Attachments:
Bump.
Sorry to bother. We will begin testing with our deployment in the next month,
but IE is still unusable. This is, of course, our problem, but this is just
such a wonderful tool that I would like to stick with it if possible.
Thank you.
Original comment by John.Pau...@gmail.com
on 4 Apr 2013 at 7:13
I'll take a look this week.
Original comment by gden...@google.com
on 8 Apr 2013 at 1:37
John, just to clarify, the error you are seeing on IE is "An unknown error
occurred. The setup survey is missing." Correct?
Original comment by gden...@google.com
on 8 Apr 2013 at 6:35
Hi John,
When you're evaluating XPaths on XML documents, you don't need this library, as
every browser (including IE) has native XPath support for XML documents. The
library is intended to provided cross-browser XPath support for HTML documents.
In your code, you current have this for IE,
document.evaluate(expression, node, null, XPathResult.ANY_TYPE, null);
since "node" in this case is a node in an XML document, you should just use
IE's native selectNodes method like this:
node.selectNodes(expression);
To be really correct, you probably want to set the SelectionLanguage to XPath
first. Documentation here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms754523(v=vs.85).aspx
Be aware that it returns a IXMLDOMNodeList, which doesn't have an iterateNext
method, but has equivalents:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms767664(v=vs.85).aspx
As long as you are only evaluating XPaths on XML documents, you shouldn't need
this library at all.
Original comment by gden...@google.com
on 8 Apr 2013 at 7:58
I see. I felt like this should be the case, but I was unable to find this. I
apologize if I wasted your time.
Original comment by John.Pau...@gmail.com
on 9 Apr 2013 at 3:51
In case anyone else comes across this issue, I have solved it without WGXP per
the above recommendation. Below is the code I used, which seems to be working
across all versions of IE, FF (15.0.1), and Chrome (26.0.1410.65).
Thanks again for your help and sorry again that this was my lack of knowledge
more than anything else.
[code]
/**
* Converts an XML string into a DOM object.
*/
function convertXmlStringToDomObject(xml) {
var xmlDoc = null;
if(window.DOMParser)
{
var parser = new DOMParser();
xmlDoc = parser.parseFromString(xml, "text/xml");
}
else // Internet Explorer
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(xml);
}
return xmlDoc;
}
/**
* Runs the document.evaluate() method based on the current browser.
*/
function evaluateXpath(root, node, expression) {
var result;
if(window.DOMParser)
{
result =
root
.evaluate(
expression,
node,
null,
XPathResult.ANY_TYPE,
null);
}
else // Internet Explorer
{
result = node.selectNodes(expression);
}
return result;
}
/**
* Returns the next element from a list of elements.
*/
function nextElement(node) {
if(window.DOMParser) {
return node.iterateNext();
}
else {
return node.nextNode();
}
}
/**
* Returns the text for the node.
*/
function elementValue(node) {
if(window.DOMParser) {
return node.textContent;
}
else {
return node.text;
}
}
[/code]
Original comment by John.Pau...@gmail.com
on 24 Apr 2013 at 5:04
Original issue reported on code.google.com by
John.Pau...@gmail.com
on 1 Mar 2013 at 6:00Attachments: