标题比它必须的要复杂,这里是问题查询。
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 文档中没有看到任何关于如何处理转义的内容。我知道这是多么的极端,但希望他们有某种逃避指南。