I've hit a wall on these XPath errors...I currently have a fresh Drupal 6.22 install with only the modules needed for this test/project.
I'm trying to import some Bing Images from the API. Seems pretty simple...
I've added 2 CCK fields to the default Page Content type.
I have the following XPath's defined:
URL: http://bit.ly/s8sX9U (a saved output for testing, originally from the Bing Image API - avoids needing a key to see XML sample, but any other Bing (http://api.bing.net/xml.aspx....) XML file would work)
Context: /SearchResponse
title: //mms:Image/mms:Results/mms:ImageResult/mms:MediaUrl
field_page_main_image: //mms:Image/mms:Results/mms:ImageResult/mms:Title
field_page_main_image_credit: //mms:Image/mms:Results/mms:ImageResult/mms:Url
One (1) page node is created with no title. The image is downloaded and placed into the imagefield, the credit is placed into the credit text field.
No other nodes are created. (should be 2 more)
I get the following Errors:
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in /home/userxxx/public_html/example.com/includes/database.mysqli.inc on line 329.
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in /home/userxxx/public_html/example.com/includes/database.mysqli.inc on line 329.
The debug of context and xpath matches seems to show the correct material is being selected:
context :
<SearchResponse xmlns="http://schemas.microsoft.com/LiveSearch/2008/04/XML/element" Version="2.0"><Query><SearchTerms>Golf Clubs</SearchTerms></Query><mms:Image xmlns:mms="http://schemas.microsoft.com/LiveSearch/2008/04/XML/multimedia"><mms:Total>5080000</mms:Total><mms:Offset>0</mms:Offset><mms:Results><mms:ImageResult><mms:Title>golf club</mms:Title><mms:MediaUrl>http://tincansunlimited.com/home/wp-content/uploads/2011/03/golf-club.jpg</mms:MediaUrl><mms:Url>http://tincansunlimited.com/2011/03/need-headline/</mms:Url><mms:DisplayUrl>http://tincansunlimited.com/2011/03/need-headline/</mms:DisplayUrl><mms:Width>2480</mms:Width><mms:Height>1754</mms:Height><mms:FileSize>171054</mms:FileSize><mms:Thumbnail><mms:Url>http://ts1.mm.bing.net/images/thumbnail.aspx?q=1310667835628&id=15f30f8a71cf193381f61e230f31a85f</mms:Url><mms:ContentType>image/jpeg</mms:ContentType><mms:Width>160</mms:Width><mms:Height>113</mms:Height><mms:FileSize>2563</mms:FileSize></mms:Thumbnail></mms:ImageResult><mms:ImageResult><mms:Title>Golf Club Screensaver screenshot 1 - This is one of the images that ...</mms:Title><mms:MediaUrl>http://i1-win.softpedia-static.com/screenshots/Golf-Club-Screensaver_1.jpg</mms:MediaUrl><mms:Url>http://www.softpedia.com/progScreenshots/Golf-Club-Screensaver-Screenshot-101722.html</mms:Url><mms:DisplayUrl>http://www.softpedia.com/progScreenshots/Golf-Club-Screensaver-Screenshot-101722.html</mms:DisplayUrl><mms:Width>847</mms:Width><mms:Height>610</mms:Height><mms:FileSize>198425</mms:FileSize><mms:Thumbnail><mms:Url>http://ts1.mm.bing.net/images/thumbnail.aspx?q=1310942767902&id=b1066ed2a8ab60f4cdbfccec7732deed</mms:Url><mms:ContentType>image/jpeg</mms:ContentType><mms:Width>160</mms:Width><mms:Height>115</mms:Height><mms:FileSize>3773</mms:FileSize></mms:Thumbnail></mms:ImageResult><mms:ImageResult><mms:Title>Golf Clubs and Golf Equipment</mms:Title><mms:MediaUrl>http://www.golfequipmentclubs.net/wp-content/uploads/2011/01/golf-club.jpg</mms:MediaUrl><mms:Url>http://golfequipmentclubs.net/</mms:Url><mms:DisplayUrl>http://golfequipmentclubs.net/</mms:DisplayUrl><mms:Width>1050</mms:Width><mms:Height>1050</mms:Height><mms:FileSize>660087</mms:FileSize><mms:Thumbnail><mms:Url>http://ts1.mm.bing.net/images/thumbnail.aspx?q=1288797954048&id=1ba3044453d42fda635359580b1577bb</mms:Url><mms:ContentType>image/jpeg</mms:ContentType><mms:Width>160</mms:Width><mms:Height>160</mms:Height><mms:FileSize>3953</mms:FileSize></mms:Thumbnail></mms:ImageResult></mms:Results></mms:Image></SearchResponse>
xpathparser:0 :
<mms:Title>golf club</mms:Title>
<mms:Title>Golf Club Screensaver screenshot 1 - This is one of the images that ...</mms:Title>
<mms:Title>Golf Clubs and Golf Equipment</mms:Title>
xpathparser:1 :
<mms:MediaUrl>http://tincansunlimited.com/home/wp-content/uploads/2011/03/golf-club.jpg</mms:MediaUrl>
<mms:MediaUrl>http://i1-win.softpedia-static.com/screenshots/Golf-Club-Screensaver_1.jpg</mms:MediaUrl>
<mms:MediaUrl>http://www.golfequipmentclubs.net/wp-content/uploads/2011/01/golf-club.jpg</mms:MediaUrl>
xpathparser:2 :
<mms:Url>http://tincansunlimited.com/2011/03/need-headline/</mms:Url>
<mms:Url>http://www.softpedia.com/progScreenshots/Golf-Club-Screensaver-Screenshot-101722.html</mms:Url>
<mms:Url>http://golfequipmentclubs.net/</mms:Url>
Created 1 Page node.
Any suggestions would be appreciated. I've stripped this "project" down to the bare elements just to get this part working.
I've also tried other methods (querypath, regex, etc) but the XPath Parser seems to the right sub-module for this job.
Thanks.
Comments
Comment #1
twistor commentedClosing out old issues. If you're still having this problem, feel free to re-open it.