xpath.js icon indicating copy to clipboard operation
xpath.js copied to clipboard

XPath selectors are case sensitive

Open mish15 opened this issue 12 years ago • 3 comments

Thanks for the project, i'm finding it useful, but one thing that stumped me for ages was the following XPath, which would not work but always had worked in PHP. I ended up seeing it was "NAME" instead of "name" in the html.

//*[@NAME='TrackingJobBody']

//*[@name='TrackingJobBody']

The two above are not the same.

mish15 avatar Aug 12 '12 11:08 mish15

Hi Mish15

Sorry for the delay in answering.

The two xpath above seems equal. Did you meant to use NAME (cpas) instead of name (lower) in one of them?

If you also try here, it seems that case matters in xpath:

http://xpath.online-toolz.com/tools/xpath-editor.php

yaronn avatar Aug 15 '12 11:08 yaronn

Hey Yaron,

No problem, thanks for open sourcing the code, very appreciated. I actually used lower case, but the target page used all CAPS. I test parse these in chrome dev tools and our current PHP also parses without caring about case.

We need to parse a bunch of non-compliant malformed HTML, so i ended up using Node for the download and kick out to PHP for the parsing. Seems to work pretty well, but i would love to parse the XPaths in node if possible...

On 15 August 2012 21:39, Yaron Naveh [email protected] wrote:

Hi Mish15

Sorry for the delay in answering.

The two xpath above seems equal. Did you meant to use NAME (cpas) instead of name (lower) in one of them?

If you also try here, it seems that case matters in xpath:

http://xpath.online-toolz.com/tools/xpath-editor.php

— Reply to this email directly or view it on GitHubhttps://github.com/yaronn/xpath.js/issues/1#issuecomment-7753779.

mish15 avatar Aug 15 '12 12:08 mish15

:+1:

Zearin avatar Jan 30 '14 16:01 Zearin