就XML / XPath处理而言,该
xmlns="http://www.w3.org/1999/xhtml"部分将
html元素放入XML名称空间。
并且
a元素继承了该命名空间。并且
//a[text() = 'Public Profile']XPath表达式将只匹配的_未命名空间_
a的元素。
//a[namespace-uri()='http://www.w3.org/1999/xhtml'][text() = 'PublicProfile']是使其匹配的一种方法。
//*[name()='a'][text() = 'Public Profile']是另一种方式。
而这
//*[text() = 'PublicProfile']是另一种方式(假设您已经知道将获得所需的
a元素,而不是其他元素)。



