XPath: "Exclude" Tag In "InnerHtml" (InnerHtmlexcludeme January 30, 2023 Post a Comment I am using XPath to query HTML sites, which works pretty good so far, but now I hit a (brick)wall and can't find a solution :-) The html looks like this: Solution 1: This gets you the first direct text node child of <a>: /ul/li/a/text()[1] Copy and this would get you any direct text node child (separately): /ul/li/a/text() Copy Both of the above return "TextX", but if you had: <li><a href="">Text4<span>AnotherText3</span>TrailingText</a></li> Copy then the latter would return: ["Text4", "TrailingText"], while the former would return "Text4" only. Your expression /ul/li/a gets the string value of <a>, which is defined as the concatenation of the string value of all the children of <a>, so you get "TextXAnotherTextX". Share Post a Comment for "XPath: "Exclude" Tag In "InnerHtml" (InnerHtmlexcludeme"
Post a Comment for "XPath: "Exclude" Tag In "InnerHtml" (InnerHtmlexcludeme"