Scrapy

2012-12-08 10 views
2

나는 내가 '가격'항목을 추출 할 XML 피드에서 XMLFeedSpiderScrapy

있는 XML 피드를 구문 분석하려고에 HTML 항목을 XML 파일에 포함 된 항목을 구문 분석하는 방법 :

<span class="price" id="product-price-2037">19,77 €</span> 

을 여기

<channel> 
<item> 
<title> 
<![CDATA[ product title ]]> 
</title> 
<meta http-equiv="X-UA-Compatible" content="IE=8"/> 
<link>http://example.com/apage.html</link> 
<description> 
<![CDATA[ 
<table><tr><td><a href="http://example.com/apage.html"> 
<img src="http://example.com/media/catalog/product/aimage173.jpg" border="0" align="left" height="75" width="75"></a></td> 
<td style="text-decoration:none;"> <div class="price-bframe"> <p class="old-price"> <span class="price-label">Prix normal :</span> 
<span class="price" id="old-price-2895037">40,00 €</span> </p> 
<p class="special-price"> <span class="price-label">Prix spécial :</span> 
<span class="price" id="product-price-2037">19,77 €</span> </p> </div> </td></tr></table> 
]]> 
</description> 
</item> 
</channel> 

내 실제 거미입니다 :

가 다음과 같이하지만,이 가격 항목은 태그 안에 html 코드에

결과 :

Invalid Xpath: *[@class=price"]text() 
+0

전에 슬래시를 놓쳤다 생각하려고 유효하지 않기 때문에 그 생각 위의 내용이 유효하지 않습니다. 어떻게 테스트하고 있습니까? – Talvalin

답변

1

나는 당신의 경로가이

[@class=price"]/text()

난 당신이 URL을 감안할 때 텍스트