Reputation: 16724
I think "text" must be a special form because when I use xml.text "hello" the tag doesn't appear in the xml doc. Whatever follows that tag is simply listed without a . I tried to use send.(:"text", "hello") but that doesn't work either.
Ideas?
Upvotes: 3
Views: 413
Reputation: 4694
Which means you need to put an underscore after the tag name.
Just to clarify with an example for anyone else who might be searching for this (such as I was):
builder = Nokogiri::XML::Builder.new do |xml|
xml.questions {
xml.question {
xml.text_ "What is your name?"
}
xml.question {
xml.text_ "What is your favourite colour?"
}
}
end
Upvotes: 4