Filter Array

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...

help me pls~~~~~~~~

im struggeling.....T.T

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...~~~

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

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

it’s better posting on the mailing list because if someone else has a similar problem, they may google it and find it.