0
lotofxpath = arrayofmanyxpaths.map{|s| "\"" + s + "\""}.join(",")
puts lotofxpath #=> "/html/body/a[1]", "/html/body/a[2]"
newb = doc.xpath(lotofxpath).to_a
这将无法正常工作,并抱怨无效的xpath。nokogiri:无效的xpath?
然而,复制粘贴输出字符串
newb = doc.xpath("/html/body/a[1]", "/html/body/a[2]").to_a
没有问题会工作!
这里发生了什么事?