Nokogiri XML 生成器换行符
Nokogiri XML Builder 正在向输出的 XML 中随机添加新行。
如何让 Nokogiri 在每个标签后输出一个新行。
例如,我得到的输出是
<books>
<book>
<title>foobar</title><author>Me
</author>
<book>
</books>
,但我想要
<books>
<book>
<title>foobar</title>
<author>Me</author>
<book>
</books>
什么是错的!!!!!!???
Nokogiri XML Builder is randomly adding new lines to the outputted XML.
How can I get Nokogiri to output a new line after each tag.
For example, the output I am getting is
<books>
<book>
<title>foobar</title><author>Me
</author>
<book>
</books>
but i want
<books>
<book>
<title>foobar</title>
<author>Me</author>
<book>
</books>
WHAT IS WRONG!!!!???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题出在您的代码中,但是,因为您说“不,我不能。我只需要一个解释”。我们无法帮助您修复它。
这会生成您想要的输出。您需要弄清楚如何使其适用于您的情况:
The problem is in your code, but, because you said "No, I can't. I just need an explanation." we can't help you fix it.
This generates the output you want. You'll need to figure out how to make it apply to your situation:
这是 Nokogiri 的 jRuby 版本的一个错误。我已经确认它存在于 jRuby 1.6.3 和 1.5.0.beta.2 上
尝试更新到最新版本,看看是否可以解决问题,如果没有,您可能只需要等待或处理它与此同时。
This is a bug with the jRuby version of Nokogiri. I've confirmed it as being present on jRuby 1.6.3 with 1.5.0.beta.2
Try updating to the latest version to see if that resolves the problem, if not you'll likely just have to wait or deal with it in the meantime.