16

I'm trying to generate some XML using XML::Builder, but my element names need to have hyphens in it.

When I try I get undefined methods, with the element name being truncated at the hyphen

xml.instruct!

xml.update-manifest do
  xml.latest-id @latest_version_update.guid
  xml.download-url @latest_version_update.download_url
  xml.release-information-url version_guid_url(@latest_vesrion_update.guid)
end

The fixed version is

xml.instruct!

xml.tag! 'update-manifest' do
  xml.tag! 'latest-id', @latest_version_update.guid
  xml.tag! 'download-url', @latest_version_update.download_url
  xml.tag! 'release-information-url', version_guid_url(@latest_vesrion_update.guid)
end
aussiegeek
  • 2,930
  • 3
  • 23
  • 29

2 Answers2

23
xml.tag! 'latest-id', "latest ID with hiphen." 
Chirantan
  • 15,304
  • 8
  • 49
  • 75
4

I have tried to fix dash or hiphen in xml to do this.

xml.send("latest-id") "latest ID With hiphen"

For more reference to go this link xml with hiphen

akbarbin
  • 4,985
  • 1
  • 28
  • 31