开发者

nokogiri xml unescape

开发者 https://www.devze.com 2022-12-23 12:26 出处:网络
i\'m just trying out nokogiri xml builder, but am having some problem tying to unescape the content. have been spending a bit of time googgling but so far can\'t find the answer.

i'm just trying out nokogiri xml builder, but am having some problem tying to unescape the content. have been spending a bit of time googgling but so far can't find the answer.

any help would be greatly appreciated.

#build xml docoument
builder = Nokogiri::XML::Builder.new do |xml|
    xml.root{
        xml.node {
      开发者_C百科      xml.value "text1 & text2"
        }
   }

end puts builder.to_xml

output i'm get is "text1 &amp text2"

but i want it to be "text1 & text2"


An unescaped ampersand would not be valid XML, hence why Nokogiri isn't letting you create that.

0

精彩评论

暂无评论...
验证码 换一张
取 消