1
xpath是否可以在另一个Level中提取某些内容?XPath over more levels
在我的表中有不同的不同行。在一个,如果它有我的行在哪里打印“bpmtestinstanz”。我需要在链接中获取链接的URL(href),以及链接中的“Instanz abbauen”以及表格行(tr)“bpmtestinstanz”中的URL(href)。但我不知道如何处理链接和打印文本的不同级别的xpath。
<tr class="htmlobject_tr even" onclick="tr_click(this, 'idp54bf6c72037f1')" onmouseover="tr_hover(this, 'idp54bf6c72037f1')" onmouseout="tr_hover(this, 'idp54bf6c72037f1')">
<td class="htmlobject_td state">
<span class="pill active">
active</span>
</td>
<td class="htmlobject_td config">
<b>
Request ID</b>
14218305642887<br>
<b>
Hostname</b>
bpmtestinstanz<br>
<b>
Typ</b>
KVM VM (localboot)<br>
<b>
CPU</b>
1<br>
<b>
Speicher</b>
1.024 GB<br>
<b>
Kernel</b>
default<br>
<b>
Festplatte</b>
5 GB<br>
<b>
Image</b>
13982361680940.cloud_14218305642887_1_<br>
<b>
IP</b>
192.168.200.166, 172.26.41.105</td>
<td class="htmlobject_td comment">
Requested by user danieldrichardt<hr>
<a class="plugin console" onclick="sshwindow = window.open('https://172.26.41.105:8022','window1722641105', 'location=0,status=0,scrollbars=yes,resizable=yes,width=973,height=500,left=100,top=100,screenX=400,screenY=100'); sshwindow.focus(); return false;" href="#">
Ajaxterm</a>
<a class="plugin novnc" target="_blank" href="api.php?action=novnc&appliance_id=14218305990082">
noVNC</a>
</td>
<td class="htmlobject_td action">
<a data-message="" class="pause" title="Instanz pausieren" href="index.php?cloud_ui=pause&cloudappliance_id[]=14218308730556">
Instanz pausieren</a>
<a data-message="" class="restart" title="Instanz neu starten" href="index.php?cloud_ui=restart&cloudappliance_id[]=14218308730556">
Instanz neu starten</a>
<a data-message="" class="private" title="Privates Image anlegen" href="index.php?cloud_ui=image_private&appliance_id=14218305990082">
Privates Image anlegen</a>
<a data-message="" class="edit" title="Instanz bearbeiten" href="index.php?cloud_ui=appliance_update&cloudappliance_id=14218308730556">
Instanz bearbeiten</a>
<a data-message="" class="remove" title="Instanz abbauen" href="index.php?cloud_ui=deprovision&cloudappliance_id[]=14218308730556">
Instanz abbauen</a>
</td>
</tr>
其每次后主机名。帮助我很多。谢谢:) – user3392820 2015-01-21 12:54:51
@ user3392820不客气。如果你喜欢,也可以看看解释。 – 2015-01-21 13:12:01