html标签的引号嵌套,使用YQL多查询& XPath解析HTML,如何转义嵌套引号?

标题比它必须更复杂,这是问题查询。

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文档中没有看到任何关于如何处理转义的内容。我知道这有多优势,但希望他们有某种逃避指南。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值