gpt4 book ai didi

ruby - Nokogiri 可以搜索 "?xml-stylesheet"标签吗?

转载 作者:数据小太阳 更新时间:2023-10-29 02:09:33 24 4
gpt4 key购买 nike

我需要解析 XML 样式表:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/templates/xslt/inspections/disclaimer_en.xsl"?>

我尝试过使用 Nokogiri:

doc.search("?xml-stylesheet").first['href']

但是我得到了错误:

`on_error': unexpected '?' after '' (Nokogiri::CSS::SyntaxError)

最佳答案

Nokogiri 无法搜索作为 XML 处理指令的标签。您可以像这样访问它们:

doc.children[0]

关于ruby - Nokogiri 可以搜索 "?xml-stylesheet"标签吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3542264/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com