0

This is the RSS I want to import. I want to write mapping to fetch the <img> tag within the <description> tag. When I import I get this.

 xpathparser:3 :
   <description>&lt;img  
   src="http://www.moneycontrol.com/news_image_files/2013/a/acquisitions_yahoo_tumblr.jpg"
   alt="Tumblr had $16.6 mn in cash when Yahoo acquired it" title="Tumblr had $16.6 mn in 
   cash when Yahoo acquired it" border="0" width="75" height="75" align=" left" 
   hspace="5"/&gt; The deal for Tumblr was the largest since Yahoo Chief Executive Marissa 
   Mayer took the role in July with a focus on reversing a long decline in Yahoo's
   business and web traffic. The deal also made Tumblr founder and CEO David Karp, 27, a
   multimillionaire.</description>

What should be the xpath to get the <img> source?

I've tried Feeds Tamper to convert &lt; to < and &gt; to >and the following xpaths, but nothing works.

   //img/@src 
   description[1]
   description/img
   description/img/@src

I am using Drupal 7.

1

This cannot be done the way you are trying. HTML embedded in XML is no different than regular text in XML. XPath has no way to look inside the HTML to query it.

There is some work being done, essentially adding another parsing step, https://drupal.org/node/1459870.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.