2016-09-23 2 views
0

$xpath = new DOMXpath($doc)을 사용하면 앵커 아래에있는 경우 div (및 해당 하위 항목)을 가져올 수 없습니다. XPath에에서XPath : 앵커 아래 div div

는 :

html[1]/body[1]/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/a[1]/div[1]/div[2]/div[1]/div[2]/img[1] 

나는 body부터 시작 하나 요소를 평가하고 내가 앵커에 도달 할 때 그것을 읽을 수의 XPath의 마지막 태그이었다.

이것은 앵커에 블록 요소를 배치하는 것이 가장 좋은 방법은 아니지만이 html 페이지는 내 것이 아니며 수정할 수 없다는 것을 알고 있습니다.

어떤 트릭이 있는지 알려주십시오.

.....<div class="main-image"> 
<a title="" style="outline-style: none; text-decoration: none;" class="jqzoom" rel="gallery1" data-active="1" href="files/product/images/239_image_raw.jpg"> 
    <div class="zoomPad"> 
     <img style="opacity: 1;" title="" src="files/product/images/239_image.jpg" alt="ABSOLUTE SUMMER 8 VITA BASSA" height="320" width="240"> 
     <div style="top: 97.6167px; left: 80px; width: 148px; height: 153px; position: absolute; border-width: 1px; display: none;" class="zoomPup"></div> 
     <div style="position: absolute; z-index: 5001; left: 239px; top: 0px; display: none;" class="zoomWindow"> 
      <div style="width: 312px;" class="zoomWrapper"><div style="width: 100%; position: absolute; display: none;" class="zoomWrapperTitle"></div> 
      <div style="width: 100%; height: 320px;" class="zoomWrapperImage"> 
       <img src="files/product/images/239_image_raw.jpg" style="position: absolute; border: 0px none; display: block; left: -169.782px; top: -206.257px;">..... 
나 자신 :)에 응답 할 것이다

답변

-1

나는 구글 크롬에서 XPath를했다,하지만 난 당신이 브라우저에 표시하는 것이 될하기 위해 같은 HTML 소스와 같은 필요가 없습니다 것을 고려하지 않았다

브라우저는 자바 스크립트 처리 후 콘텐츠를 보여줍니다. ......