S
Saeed Bhuta
Hi All,
I am saving some html code in an Array, I then want to extract certain
values from the html code.
I have saved the html code into an Array but having difficulty
manipulating the elements to extract the exact value that I require from
the html code.
Here is the code:
#searches for images in the page which indicate platform number and
stores them in an array
platImages = (@doc/'img[@width^="54"]')
#above search returns an unwanted image, so delete
platImages.pop
#puts platImages
#go through images names to get platform number
platImages.each { |img|
#convert element to string
img.to_s
#in this part, I have tried various string manipulation
methods to extract the values that i need, but doesn't seem to work, it
either returns nil for each element or throws an error
puts img
}
Any help is greatly appreciated.
Saeed.
I am saving some html code in an Array, I then want to extract certain
values from the html code.
I have saved the html code into an Array but having difficulty
manipulating the elements to extract the exact value that I require from
the html code.
Here is the code:
#searches for images in the page which indicate platform number and
stores them in an array
platImages = (@doc/'img[@width^="54"]')
#above search returns an unwanted image, so delete
platImages.pop
#puts platImages
#go through images names to get platform number
platImages.each { |img|
#convert element to string
img.to_s
#in this part, I have tried various string manipulation
methods to extract the values that i need, but doesn't seem to work, it
either returns nil for each element or throws an error
puts img
}
Any help is greatly appreciated.
Saeed.