문제

나는 사용하려고했다 ends-with HTML 민첩성 팩에서 다음 모드에서 : //span[ends-with(@id, 'Label2')] 그리고 //span[ends-with(., 'test')] 그러나 작동하지 않습니다.

다른 모든 기능 starts-with 그리고 contains 잘 작동합니다.

누구든지 나를 도울 수 있습니까?

도움이 되었습니까?

해결책

해킹을 찾을 수 있습니다! 그것은 다음과 같습니다.

// span [ 'label2'= substring (@id, string-length (@id) -string-length ( '_ label2')+1)

다른 팁

예; 여기 나도 지원되지 않습니다 XmlDocument. 아마도 수동으로 반복 할 수 있습니다 //span[@id]?

foreach (var node in from HtmlNode n in doc.DocumentNode.SelectNodes(@"//span[@id]")
                     where n.GetAttributeValue("id","").EndsWith("Label2")
                     select n)
 {
     Console.WriteLine(node.OuterHtml);
 }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top