{"action":"closed","issue":{"url":"https://api.github.com/repos/google/wicked-good-xpath/issues/19","repository_url":"https://api.github.com/repos/google/wicked-good-xpath","labels_url":"https://api.github.com/repos/google/wicked-good-xpath/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/google/wicked-good-xpath/issues/19/comments","events_url":"https://api.github.com/repos/google/wicked-good-xpath/issues/19/events","html_url":"https://github.com/google/wicked-good-xpath/issues/19","id":65765609,"number":19,"title":"While evaluating xpath having element names with .(period) character fail with an error *Bad Token .*","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/wicked-good-xpath/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/google/wicked-good-xpath/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/google/wicked-good-xpath/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-01T19:51:08Z","updated_at":"2016-02-16T22:51:50Z","closed_at":"2016-02-16T22:51:50Z","body":"```\nThe library throws error when the element names in xpath has period (.) in it.\n\nTo reproduce the problem\n1. Create an XML Document with period in element names. Using jQuery you can \ncreate the document using the code\n     var xml = \"<abc><a.d>12</a.d></abc>\";\n     var xmlDoc = $.parseXML(xml);\n     wgxpath.install();\n     var result = document.evaluate(\"/abc/a.d\",xmlDoc, null, XPathResult.ANY_TYPE, null);\n\n2. The same script runs on Chrome which provides native support for \ndocument.evaluate but not on IE11 using this library. It fails with an error\n\n  SCRIPT5022: Bad token: .\n  File: wgxpath.install.js, Line: 47, Column: 609\n\n3. I have created a fiddle http://jsfiddle.net/r0gruz30/ which reproduces the \nproblem. Open the fiddle in chrome and the output will be *Result is 12* but in \nIE the output is *Result is* and there is an error in the console\n\n  SCRIPT5022: Bad token: .\n  File: wgxpath.install.js, Line: 47, Column: 609\n\n\nI am using the latest wgxpath library and seeing the issue on IE11 windows 7.\n\nI debugged the code and found that the reason for the issue is in lexer.js. The \nregular expression for _TOKEN does not takes care of periods in element names. \nSo if I change the regex \n\nwgxpath.Lexer.TOKEN_ = new RegExp(\n    '\\\\$?(?:(?![0-9-])[\\\\w-]+:)?(?![0-9-])[\\\\w-]+' +\n    ...\n    .....,\n   'g')\n\nto \n\nwgxpath.Lexer.TOKEN_ = new RegExp(\n    '\\\\$?(?:(?![0-9-\\\\.])[\\\\w\\\\.-]+:)?(?![0-9-\\\\.])[\\\\w-\\\\.]+' +\n    ...\n    .....,\n   'g')\n\nit works. \n```\n\nOriginal issue reported on code.google.com by `varundua...@gmail.com` on 24 Feb 2015 at 10:57"}}