как я добавляю комментарий к xpath?

Это не могло бы ответить точно на Ваш вопрос, но здесь является редактором, позволяет иметь более высокое представление кода: http://webpages.charter.net/edreamleo/front.html

9
задан gweg 4 November 2009 в 21:04
поделиться

2 ответа

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.

14
ответ дан 4 December 2019 в 06:41
поделиться

2019 edit
As pointed out in @Sepster's reply and elsewhere, starting with XPath 2.0, comments became possible with their cute "smiley face"-looking syntax. I'm only about 10 years late in editing this reply to mention very useful fact ;-)

Original reply c. 2009 (assumed XPATH 1.0)
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...)

6
ответ дан 4 December 2019 в 06:41
поделиться
Другие вопросы по тегам:

Похожие вопросы: