我在使用Nokogiri在XML文档中选择URL时遇到了困难,尝试使用CSS选择器,除了孩子中的标记之外它还可以正常工作。我认为这必须归因于括号<被写为&lt;&gt;有没有解决的办法?
<br /><strong>URL:</strong> <a href="https://url.com/">https://url.com/</a>
require 'cgi'
CGI.unescapeHTML('<br /><strong>URL:</strong> <a href="https://url.com/">https://url.com/</a>')
给
<br /><strong>URL:</strong> <a href=\"https://url.com/\">https://url.com/</a>
也许你只需要首先浏览你的HTML