Hello... I''m trying to generate and XML file using .rxml and I''m having a problem with element names that contain a hyphen. Here is a chunk of the .rxml file: xml.instruct! :xml, :version=>"1.0" xml.properties do @properties.each do |p| xml.property do xml.location do xml.street-address(p.street_address) xml.city-name(p.city) .. end end end end As soon as the code hits the street-address line, a NoMethodError is thrown: undefined method `address'' for #<#<Class:0x664ede8>:0x664edc0> Any idea how to fix this? The hyphens are dictated by the client, thus I can''t change that. Thanks, Jeff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
jjudge wrote:> xml.street-address(p.street_address)>> x = Builder::XmlMarkup.new;nil=> nil>> x.tag!(''a-b'')=> "<a-b/>" That''s in one of the Pragmatic books IIRC. -- Phlip http://flea.sourceforge.net/PiglegToo_1.html --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, that worked. To show the data within the element, use:
xml.tag!("street-address", p.street_address)
On Mar 26, 1:16 am, "Phlip"
<phlip2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> jjudge wrote:
> > xml.street-address(p.street_address)
> >> x = Builder::XmlMarkup.new;nil
> => nil
> >> x.tag!(''a-b'')
>
> => "<a-b/>"
>
> That''s in one of the Pragmatic books IIRC.
>
> --
> Phlip
> http://flea.sourceforge.net/PiglegToo_1.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---