문제

I'm using XPath to parse an HTML document to find a specific link. The specific link has a domain name in it and the character '@'.

//a[@*[contains(., 'domain')]] | //a[@*[contains(., '@')]]"

Will return links with 'domain' OR '@' in them and I need 'domain' AND '@'

I've been trying to use:

//a[@*[contains(., 'domain')]] & //a[@*[contains(., '@')]]"

But that's no good.

도움이 되었습니까?

해결책

You can read about XPath operators here. The & operator does not exist. Also, there is no need to select the element twice. You could use either

//a[@*[contains(., 'domain')]][@*[contains(., '@')]]

or

//a[@*[contains(., 'domain')] and @*[contains(., '@')]]

다른 팁

Should be as easy as:

//a[@*[contains(., 'domain')]][@*[contains(., '@')]]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top