我正在嘗試使用HTML單元從網頁中提取數據。通過將HtmlPage轉換為文本,然后使用該HTML頁面中的正則表達式提取數據,我已經實現了這一點。我還實現了使用HTML中的class屬性從HTML表中提取數據。我想再次對所有提取再次完全使用HtmlUnit,以學習使用正則表達式所做的相同要求。無法獲取如何以鍵值對的形式提取標記內的數據。這是樣本HTML數據<div class="top_red_bar"> <div id="site-breadcrumbs"> <a href="/admin/index.jsp" title="Home">Home</a> | <a href="/admin/queues.jsp" title="Queues">Queues</a> | <a href="/admin/topics.jsp" title="Topics">Topics</a> | <a href="/admin/subscribers.jsp" title="Subscribers">Subscribers</a> | <a href="/admin/connections.jsp" title="Connections">Connections</a> | <a href="/admin/network.jsp" title="Network">Network</a> | <a href="/admin/scheduled.jsp" title="Scheduled">Scheduled</a> | <a href="/admin/send.jsp" title="Send">Send</a> </div> <div id="site-quicklinks"><P> <a href="http://activemq.apache.org/support.html" title="Get help and support using Apache ActiveMQ">Support</a></p> </div></div><table border="0"><tbody> <tr> <td valign="top" width="100%" style="overflow:hidden;"> <div class="body-content"><h2>Welcome!</h2><p>Welcome to the Apache ActiveMQ Console of <b>localhost</b> (ID:TOOLCONTROLPJX526-524666-65544585445-2:3)</p><p>You can find more information about Apache ActiveMQ on the <a href="http://activemq.apache.org/">Apache ActiveMQ Site</a></p><h2>Broker</h2><table> <tr> <td>Name</td> <td><b>localhost</b></td> </tr> <tr> <td>Version</td> <td><b>5.13.3</b></td> </tr> <tr> <td>ID</td> <td><b>ID:TOOLCONTROLPJX526-524666-65544585445-2:3</b></td> </tr> <tr> <td>Uptime</td> <td><b>17 days 13 hours</b></td> </tr>我想提取表標簽之間的數據。預期產量Name:localhostVersion:5.13.3ID:ID:TOOLCONTROLPJX526-524666-65544585445-2:3Uptime:7 days 13 hoursStore percent used:19Memory percent used:0Temp percent used:0如何實現?我想知道要在HTLM單元中使用哪些方法來實現這一目標。
添加回答
舉報
0/150
提交
取消