Hi, we''re exporting a lot of html code within xml, our current method works but it''s very messy - far from perfect, is there a better way to do this. an example of our controller code is html = html + "<img src="/icon/icon_email.gif" onclick="javascript:document.getElementById('detail').style.display='none'; document.getElementById('mailform').style.display='inline'; "/>\n" as you can see we''re using the < etc to generate the html required, so the end result is something like <marker html="<img src="/icon/icon_email.gif" onclick="javascript:document.getElementById(''detail'').style.display=''none''; document.getElementById(''mailform'').style.display=''inline''; "/>... so within that xml tag you can see a html= option, and within that option lives all our html. can anyone suggest a cleaner better way to do this? it would really be appreciated. thanks -- Posted via http://www.ruby-forum.com/.
Is it too naive to suggest using the view (or a pseudo view) to generate the html using erb? After all that is what erb is for. Colin 2009/5/7 Todd Fox <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > Hi, > > we''re exporting a lot of html code within xml, our current method works > but it''s very messy - far from perfect, is there a better way to do > this. > > an example of our controller code is > > html = html + "<img src="/icon/icon_email.gif" > > onclick="javascript:document.getElementById('detail').style.display='none'; > document.getElementById('mailform').style.display='inline'; > "/>\n" > > as you can see we''re using the < etc to generate the html required, > so the end result is something like > > <marker html="<img src="/icon/icon_email.gif" > onclick="javascript:document.getElementById(''detail'').style.display=''none''; > document.getElementById(''mailform'').style.display=''inline''; "/>... > > so within that xml tag you can see a html= option, and within that > option lives all our html. > > can anyone suggest a cleaner better way to do this? it would really be > appreciated. > > thanks > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
how would that work? -- Posted via http://www.ruby-forum.com/.
Todd Fox wrote:> how would that work?we need the html in xml (html wrapped inside the xml) for another application read and then render that html. -- Posted via http://www.ruby-forum.com/.
I am not sure exactly what you would do, I am also not sure exactly what you are doing with the xml. It just seems that an erb view is the ideal tool for generating html to be sent to the client. Is there a lot of xml or is it just a wrapper round the html? If only a wrapper then you could generate that ''by hand'' so to speak in the erb file also, or in the layout file. Can anyone else help? I do not really know what I am talking about here. Colin 2009/5/7 Todd Fox <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > Todd Fox wrote: > > how would that work? > > we need the html in xml (html wrapped inside the xml) for another > application read and then render that html. > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Thu, May 7, 2009 at 9:28 AM, Todd Fox <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> we need the html in xml (html wrapped inside the xml) for another > application read and then render that html.Does the html need to be an attribute? Or can it just be within an xml envelope? IOW, do you control the consuming end of this? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
sorry more info on what it''s used for would help, the xml is being read by google maps api so we can load html code inside the popup bubble. so yeah we dont really control the consuming end :( -- Posted via http://www.ruby-forum.com/.
Marnen Laibow-Koser
2009-May-08 02:39 UTC
Re: is there simpler way to export html within xml
Todd Fox wrote:> sorry more info on what it''s used for would help, the xml is being read > by google maps api so we can load html code inside the popup bubble. > > so yeah we dont really control the consuming end :(It seems to me, then, that you have two good options. Either use ERb and/or Builder to put the HTML in the XML DOM, or (if the HTML has to be a string) use a CDATA section. Don''t make your life harder with all those &entities;. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
thanks Marnen and everyone, do you know of any examples or something i can have a look at to get my head around it? -- Posted via http://www.ruby-forum.com/.
Marnen Laibow-Koser
2009-May-08 02:50 UTC
Re: is there simpler way to export html within xml
Todd Fox wrote:> thanks Marnen and everyone, do you know of any examples or something i > can have a look at to get my head around it?What''s to get your head around? Just pretend your XML file is an HTML page, and proceed accordingly with your favorite template language (ERb, Builder, Haml, Markaby, whatever). There''s no new concept involved. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Way to be appreciative of someone trying to help you. Good luck with that. On May 7, 9:50 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas- s.net> wrote:> Todd Fox wrote: > > thanks Marnen and everyone, do you know of any examples or something i > > can have a look at to get my head around it? > > What''s to get your head around? Just pretend your XML file is an HTML > page, and proceed accordingly with your favorite template language (ERb, > Builder, Haml, Markaby, whatever). There''s no new concept involved. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://www.ruby-forum.com/.
My bad MLK. On May 8, 11:40 am, Osiris <mchugh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Way to be appreciative of someone trying to help you. Good luck with > that. > > On May 7, 9:50 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas- > > s.net> wrote: > > Todd Fox wrote: > > > thanks Marnen and everyone, do you know of any examples or something i > > > can have a look at to get my head around it? > > > What''s to get your head around? Just pretend your XML file is an HTML > > page, and proceed accordingly with your favorite template language (ERb, > > Builder, Haml, Markaby, whatever). There''s no new concept involved. > > > Best, > > -- > > Marnen Laibow-Koserhttp://www.marnen.org > > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > > Posted viahttp://www.ruby-forum.com/.