我正在嘗試從SEC存檔網站中提取以下信息。1)大型加速文件管理器 2)加速文件管理器 3)非加速文件管理器 4)小型報告公司 5)新興成長型公司這是它在網站上的顯示方式:Large accelerated filer ? Accelerated filer ?Non-accelerated filer ? (Do not check if a smaller reporting company) Smaller reporting company ?Emerging growth company ?在某些情況下,一個或多個項目可能不存在。我想編寫一個通用代碼,可以為許多公司提取這些值?,F在我面臨的問題是HTML的結構正在從一個公司到另一個公司發生變化。到目前為止,我已經遇到了3種不同的結構(請參閱下面的HTML結構)。如何編寫代碼以跨不同結構進行泛化?<td valign="bottom">Large accelerated filer</td><td valign="bottom"> </td><td valign="bottom">?</td><td valign="bottom"> </td><td valign="bottom">Accelerated filer</td><td valign="bottom"> </td><td valign="bottom">?</td></tr><tr style="page-break-inside:avoid ; font-family:Times New Roman; font-size:10pt"><td valign="bottom"><font style="white-space:nowrap">Non-accelerated filer</font></td><td valign="bottom"> </td><td valign="bottom">? (Do not check if a smaller reporting company)</td><td valign="bottom"> </td><td valign="bottom">Smaller reporting company</td><td valign="bottom"> </td><td valign="bottom">?</td></tr><tr style="page-break-inside:avoid ; font-family:Times New Roman; font-size:10pt"><td valign="bottom">Emerging growth company</td><td valign="bottom"> </td><td valign="bottom">?</td><td valign="bottom"> </td><td valign="bottom"></td><td valign="bottom"> </td><td valign="bottom"></td></tr>另一種結構:filer <font style="FONT-FAMILY:WINGDINGS">x</font> Accelerated filer <font style="FONT-FAMILY:WINGDINGS">¨</font> Non-accelerated filer <font style="FONT-FAMILY:WINGDINGS">¨</font> Smaller reporting company <font style="FONT-FAMILY:WINGDINGS">¨</font> </font>
1 回答

米脂
TA貢獻1836條經驗 獲得超3個贊
您可以嘗試3個XPath的組合(|運算符)來獲得您需要的東西(已勾選的項目):
//td[.="?"]/preceding::td[string-length(.)>1][1]/text()|//font[.="x"]/following::text()[1]|//font[.="t"]/preceding::text()[1]
您提供的 html 格式不正確。如果它不起作用,請提供其他內容。
添加回答
舉報
0/150
提交
取消