My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 1: #<an Element> has no method 'selectSingleNode' in Chrome
2 people starred this issue and may be notified of changes. Back to list
Status:  Duplicate
Merged:  issue 3
Owner:  harald.pehl
Closed:  Dec 2010


 
Reported by peter.sl...@gmail.com, Oct 5, 2010
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
There's no issue using the gwt.sarissa.zip from ebessette and sarissa 0.9.9.5. The totoe package is however far superior over the gwt.sarissa package. So I really prefer the issue being solved in totoe.
Nov 2, 2010
Project Member #2 harald.pehl
(No comment was entered for this change.)
Status: Accepted
Owner: harald.pehl
Nov 2, 2010
Project Member #3 harald.pehl
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
#4 goudreau...@gmail.com
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
#5 goudreau...@gmail.com
Doesn't have the problem on chrome 7 for mac.
Nov 8, 2010
Project Member #6 harald.pehl
So it seems this is an error related to Chrome 7 on Windows?
@Peter, Christian: Is this correct?
Nov 8, 2010
#7 goudreau...@gmail.com
Well yeah, on windows I did had this problem, but I switched to chrome 9 dev lately and it's gone.
Nov 8, 2010
Project Member #8 harald.pehl
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
Dec 26, 2010
Project Member #9 harald.pehl
Seems to be related to  issue #3 
Status: Duplicate
Mergedinto: 3

Powered by Google Project Hosting