使XML构建器从字符串插入XML

时间:2021-01-31 20:16:12

I have an XML view in a rails app, and need to insert in XML from another file for testing purposes.

我在rails应用程序中有一个XML视图,需要从另一个文件中插入XML以进行测试。

I want to say "builder, just stuff this string in blindly, because it's already xml", but I can't see to see anything in the docs that does that.

我想说“构建器,只是盲目地填充此字符串,因为它已经是xml”,但我看不到在文档中看到任何内容。

1 个解决方案

#1


6  

I knew I'd figure it out right after posting a question. Using target! is the answer

我知道在发布问题后我会立即弄明白。使用目标!是答案

xml.Foo do
  xml.built('build with builder')
  xml.alsobuilt do
    xml.builtinside('built inside')
    xml.target! << my_string_with_xml
  end
end

Achieves the results desired.

达到预期的效果。

#1


6  

I knew I'd figure it out right after posting a question. Using target! is the answer

我知道在发布问题后我会立即弄明白。使用目标!是答案

xml.Foo do
  xml.built('build with builder')
  xml.alsobuilt do
    xml.builtinside('built inside')
    xml.target! << my_string_with_xml
  end
end

Achieves the results desired.

达到预期的效果。