标题比它必须更复杂,这是问题查询。
SELECT *
FROM query.multi
WHERE queries="
SELECT *
FROM html
WHERE url='http://www.stumbleupon.com/url/http://www.guildwars2.com'
AND xpath='//li[@class="listLi"]/div[@class="views"]/a/span';
SELECT *
FROM xml
WHERE url='http://services.digg.com/1.0/endpoint?method=story.getAll&link=http://www.guildwars2.com';
SELECT *
FROM json
WHERE url='http://api.tweetmeme.com/url_info.json?url=http://www.guildwars2.com';
SELECT *
FROM xml
WHERE url='http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www.guildwars2.com';
SELECT *
FROM json
WHERE url='http://www.reddit.com/button_info.json?url=http://www.guildwars2.com'"
特别是这条线,
xpath='//li[@class="listLi"]/div[@class="views"]/a/span'
这是有问题的,因为引用,我必须嵌套他们三个级别深,我已经用完了引号字符。我尝试了以下变化而没有成功:
//no attribute quoting
xpath='//li[@class=listLi]/div[@class=views]/a/span'
//try to quote attribute w/ backslash & single quote
xpath='//li[@class='listLi']/div[@class='views']/a/span'
//try to quote attribute w/ backslash & double quote
xpath='//li[@class="listLi"]/div[@class="views"]/a/span'
//try to quote attribute with double single quotes, like SQL
xpath='//li[@class=''listLi'']/div[@class=''views'']/a/span'
//try to quote attribute with double double quotes, like SQL
xpath='//li[@class=""listLi""]/div[@class=""views""]/a/span'
//try to quote attribute with quote entities
xpath='//li[@class="listLi"]/div[@class="views"]/a/span'
//try to surround XPath with backslash & double quote
xpath="//li[@class='listLi']/div[@class='views']/a/span"
//try to surround XPath with double double quote
xpath=""//li[@class='listLi']/div[@class='views']/a/span""
一切都没有成功。
我没有看到很多关于转义XPath字符串的内容,但是我发现的所有内容似乎都是使用concat的变体(这不会有帮助,因为既不'或'也不可用)或html实体。不使用引号的属性不抛出错误但失败,因为它不是我需要的实际XPath字符串。
我在YQL文档中没有看到任何关于如何处理转义的内容。我知道这有多优势,但希望他们有某种逃避指南。