{"action":"opened","issue":{"url":"https://api.github.com/repos/polotek/libxmljs/issues/294","labels_url":"https://api.github.com/repos/polotek/libxmljs/issues/294/labels{/name}","comments_url":"https://api.github.com/repos/polotek/libxmljs/issues/294/comments","events_url":"https://api.github.com/repos/polotek/libxmljs/issues/294/events","html_url":"https://github.com/polotek/libxmljs/issues/294","id":62465149,"number":294,"title":"//grandchild only returns one element (first)","user":{"login":"monkeyfdude","id":4950527,"avatar_url":"https://avatars.githubusercontent.com/u/4950527?v=3","gravatar_id":"","url":"https://api.github.com/users/monkeyfdude","html_url":"https://github.com/monkeyfdude","followers_url":"https://api.github.com/users/monkeyfdude/followers","following_url":"https://api.github.com/users/monkeyfdude/following{/other_user}","gists_url":"https://api.github.com/users/monkeyfdude/gists{/gist_id}","starred_url":"https://api.github.com/users/monkeyfdude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monkeyfdude/subscriptions","organizations_url":"https://api.github.com/users/monkeyfdude/orgs","repos_url":"https://api.github.com/users/monkeyfdude/repos","events_url":"https://api.github.com/users/monkeyfdude/events{/privacy}","received_events_url":"https://api.github.com/users/monkeyfdude/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-17T17:28:16Z","updated_at":"2015-03-17T17:28:16Z","closed_at":null,"body":"Following code is what I thought gave me error. Please help me understand if its an issue\r\n\r\nFor the xml below, I expect two grandchild elements but I get only one. How do I get two for\r\n```\r\nconsole.log(gchild.text());  // prints \"grandchild content\"\r\n```\r\n```\r\nvar libxmljs = require(\"libxmljs\");\r\nvar xml =  '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' +\r\n           '<root>' +\r\n               '<child foo=\"bar\">' +\r\n                   '<grandchild baz=\"fizbuzz\">grandchild content</grandchild>' +\r\n               '</child>' +\r\n               '<child foo=\"bar\">' +\r\n                   '<grandchild baz=\"fizbuzz2\">grandchild2 content</grandchild>' +\r\n               '</child>' +\r\n\r\n               '<sibling>with content!</sibling>' +\r\n           '</root>';\r\n\r\nvar xmlDoc = libxmljs.parseXml(xml);\r\n\r\n// xpath queries\r\nvar gchild = xmlDoc.get('//grandchild');\r\n\r\nconsole.log(gchild.text());  // prints \"grandchild content\"\r\n\r\nvar children = xmlDoc.root().childNodes();\r\nvar child = children[0];\r\n\r\nconsole.log(child.attr('foo').value()); // prints \"bar\"\r\n```"}}