Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chuyeow/110925 to your computer and use it in GitHub Desktop.
Save chuyeow/110925 to your computer and use it in GitHub Desktop.
builder = Nokogiri::XML::Builder.new do |xml|
xml.listings {
xml.language 'en'
properties.each do |property|
xml.listing {
# Instantiate a Nokogiri::XML::Node and insert it manually.
node = Nokogiri::XML::Node.new('id', doc) # doc is actually Nokogiri::XML::Builder#doc.
node.content = property.id
insert(node)
xml.name property.name
}
end
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment