hihi, can i ask if how can i filter an Array using ruby? i have this xml doc with these datas <a>a</a> <b>b</b> <c>c</c> this is my code invisibility = XPath.first( doc, "//lm:landmark" ) XPath.each( doc, "//lm:name") { |element| puts element.text } names = XPath.match( doc, "//lm:name" ) puts names so how am i gonna filter out the <a></a> and it jus shows me a instead of the tags too? pls i really need help urgently... -- 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 -~----------~----~----~----~------~----~------~--~---
help me pls~~~~~~~~ im struggeling.....T.T -- 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 -~----------~----~----~----~------~----~------~--~---
invisibility = XPath.first( doc, "//lm:landmark" ) names = XPath.each( doc, "//lm:name") { |element| puts element.text } puts names jus split the string is enough... how...~~~ -- 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 Jun 3, 10:01 am, loki ja <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> invisibility = XPath.first( doc, "//lm:landmark" ) > names = XPath.each( doc, "//lm:name") { |element| puts element.text } >You probably meant something like names = [] XPath.each ( doc, "//lm:name") { |element| names << element.text } In your code the block does nothing apart from output the text - the return value is just the collection iterated over. Fred> puts names > > jus split the string is enough... how...~~~ > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
wow thx fred for helping me~~~ i got my things work now!!! really appreciate ur help!!! if u don mind can pm me ur contact so i can ask u question if i have problem?? hehe... if cant its alright~~~ cause im really new to ruby but need to start creating application using these ruby... ehhe... anyway thx alot -- 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 -~----------~----~----~----~------~----~------~--~---
it''s better posting on the mailing list because if someone else has a similar problem, they may google it and find it. On Wed, Jun 4, 2008 at 11:10 AM, loki ja <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > wow thx fred for helping me~~~ i got my things work now!!! > > really appreciate ur help!!! > > if u don mind can pm me ur contact so i can ask u question if i have > problem?? > > hehe... if cant its alright~~~ > > cause im really new to ruby but need to start creating application using > these ruby... ehhe... > > anyway thx alot > -- > Posted via http://www.ruby-forum.com/. > > > >-- Appreciated my help? Recommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---