| Issue 1: | #<an Element> has no method 'selectSingleNode' in Chrome | |
| 2 people starred this issue and may be notified of changes. | Back to list |
List<Node> products = document.selectNodes("//product");
Window.alert(products.size()+"");
for ( Iterator<Node> ni = products.iterator(); ni.hasNext(); ) {
Node n1 = ni.next();
Window.alert(n1.getClass().getName());
Node n2 = n1.selectNode("./@name");
Window.alert(n2.getName());
}
Results in an error in Chrome. IE7+8, Safari, FF3.5+3.6 work fine
Uncaught name.pehl.totoe.client.XPathException: (Error): TypeError: Object #<an Element> has no method 'selectSingleNode'
stack: Error: TypeError: Object #<an Element> has no method 'selectSingleNode'
What steps will reproduce the problem?
1. Given the above code the statement n1.selectNode("./@name") causes the error
2. Not only the selectNode, but also selectNodes will result in similar errors in Chrome when the context is an ElementImpl node. On a Document Chrome works fine
What is the expected output? What do you see instead?
Then expected output is the string "name", but in Chrome there is no output, just the error. The first 2 alerts in the code work fine in Chrome too.
What version of the product are you using? On what operating system?
totoe 0.1 on Tomcat 5.5 on Windows and GWT 2.0.2
Please provide any additional information below.
The xml used
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product name="abc"/>
<product name="def"/>
<product name="ghi"/>
</products>
Oct 5, 2010
#1
peter.sl...@gmail.com
Nov 2, 2010
(No comment was entered for this change.)
Status:
Accepted
Owner: harald.pehl
Nov 2, 2010
I tested your data in the XmlParserApp in production mode using Chrome 8.0.552.18 dev: XML: <?xml version="1.0" encoding="UTF-8"?> <products> <product name="abc"/> <product name="def"/> <product name="ghi"/> </products> XPath: @name Context: //product[1] Namespace: <empty> The result was: Result contains 1 node(s). Node #0: Name: name, Type: ATTRIBUTE, Text: 'abc' Result of serialize() over all nodes: abc Can you verify this using your setup?
Status:
Started
Nov 2, 2010
If that can help,
that code:
private void onGetBlogPostsSucceeded(String blogPostsXml) {
XmlParser xmlParser = xmlParserProvider.get();
Document document = xmlParser.parse(blogPostsXml);
List<BlogItem> blogItems = new ArrayList<BlogItem>();
for (Element element : document.findByName(blogItemName)) {
blogItems.add(reader.read(element));
}
getView().setBlogItems(blogItems);
}
was also doing that error on chrome 7
Cheers,
Nov 8, 2010
Doesn't have the problem on chrome 7 for mac.
Nov 8, 2010
So it seems this is an error related to Chrome 7 on Windows? @Peter, Christian: Is this correct?
Nov 8, 2010
Well yeah, on windows I did had this problem, but I switched to chrome 9 dev lately and it's gone.
Nov 8, 2010
Hmm quite hard to reproduce since I'm developing on Ubuntu and as far as I can remember never had problems with Chrome (I was using Chrome 7, 8 and now 9dev) I will leave this open as a reminder but lower priority.
Labels:
-Priority-Medium Priority-Low
|