변경할 수없는 형식이 잘못된 HTML이 있습니다. 의 XPath 쿼리를 실행하면 전혀 노드를 반환하지 않습니다형식이 잘못된 HTML 및 XPath 쿼리
$el = $xpath->query("//a[@class='product']/table"); // can get a tag with "//a[@class='product']"
print_r($el->length); // 0
잘못된 HTML :
<a class="product" href="#">
<table width="385" cellspacing="0" cellpadding="5" style="border:1px; border-bottom-color:#E2E2E2; border-bottom-style:solid;">
<tr>
<td width="55">
<img src="http://foobar.com:8080/img/1212.jpg" height="50" width="50">
</td>
<td width="195">Cod.27731<br>Product Name</td>
<td width="60" align="center"><a href="?pageContent=items&price=fab&prodcod=27731">Details</a></td>
<td width="80" nowrap>
<div style="color:#FF0000;"><strong>$ 35.23</strong></div>
</td>
</tr>
</table>
</a>
내가이 (가) 요소를 얻을 수 있습니다하지만 난 그 자식 (테이블)를 얻을 수 없다 ..
'$ 문서 수준> saveHTML()'당신은 알 수 있다는 그 DOMDocument를 자동 -앞에 '' 태그를 닫습니다. – arnaud576875
HTML()이 잘못된 HTML을 저장합니까? – thom
'loadHTML()'이 이미 잘못된 HTML을 고치고 있다고 생각합니다. (이 경우 태그를 닫음으로써) – arnaud576875