1

So I have an xml doc being generated based on product info in rails (using the builder markup (http://builder.rubyforge.org/classes/Builder/XmlMarkup.html), but when I use builders namespace syntax, the value I want to print is absent. Here's the code:

xml.tag!("rrs", {"xmlns:g"=>"http://base.google.com/ns/1.0"}) do
 @products.each do |p|
   xml.item do
     xml.id p.id                  # This works and prints: <id>123</id>
     xml.tag!("g:id") { p.id }    # This DOESN'T work and prints: <g:id></g:id>
    end
  end
end 

Notice that the p.id isn't printed when I use the .tag! as the docs say to.

Is this a simple syntax issue I'm screwing up?

Thanks in advance!

2
  • 2
    Have you tried xml.tag!('g:id', p.id)? Commented Jul 20, 2016 at 20:42
  • NOPE! That's it! I tried almost everything but that. Thanks so much, Mladen! Commented Jul 20, 2016 at 20:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.