【发布时间】:2011-12-20 19:23:19
【问题描述】:
我正在尝试在 XML 文件中包含指向图像的 URL,并且 URL 查询字符串中的 & 符号被删除:
bgdoc.xpath('//Master').each do |elem|
part = elem.xpath('Part').inner_text
image = imagehash[part]
image = "" if image.blank?
elem.xpath('Image').first.content = "<![CDATA[#{image}]]>"
puts elem.xpath('Image').first.content
end
bgdoc 稍后将在 Builder 的帮助下编写出来。但不是单个元素,它会一次全部插入。这使得它与 SO 上发布的类似问题不同。
【问题讨论】: