tags:

views:

60

answers:

2

for example i have an xpath and wish to add a comment near it to identify it.

/html/body/div/table/tr/td/a{this is a link}
+5  A: 

No, the XPATH syntax doesn't allow to embed comments within the path string.

This is typically not a significant limitation because paths are usually short and a comment can be placed nearby, in the particular syntax of the host language (XSLT, C#, whatever...)

mjv
+1  A: 

Not a comment syntax, but you can give string literals as predicate, which evaluates as true (imho) and should not change the outcome of the expression. I don't know if this has big performance drawbacks.

/html/body/div/table["this is"]["a table"]/tr/td/a["this is a link"]

But like mjv said, I also would stick to the syntax of the host language.

andre-r
Hah, kind of clever.
James Sulak