I need some help to build this line in xml. For google content api
Outcome I’m trying to get is <scp:price unit='USD'>25</scp:price>
At the moment my code output this line <scp:price unit='USD'>25</scp:price unit='USD'> which is incorrect.
Here is my code
b = Nokogiri::XML::Builder.new do |xml|
xml.send("scp:price unit='USD'",'25')
end
Thanks so much in advance
Your problem is that Nokogiri is interpreting the whole
scp:price unit='USD'as the tag name. You should get better results if you separate the tag name from the attributes:That should give you the
<scp:price unit="USD">25</scp:price>that you’re looking for.