On Jan 23, 2014, at 7:00 AM, Astm Ali wrote:

> Dear Walter
> 
> I know that my old way not the true way
> 
> now I can open my svg file using the Nokogiri Slop by using this code
> 
> 
> @test = Nokogiri::Slop(File.open("./file.svg"))
> <% @test.xpath('//text').map do |i|%>
> <%=i%><br>
> <%  end  %>
> 
> now I can get the all text records
> now when i'm trying to get the (stroke) to every record it always gives
> me error
> 
> I'm using this command
> <%=i.("[@stroke]").text.content %>
> 
> so how i can get the  font-family,font-size,fill ,stroke
> to every record ???

Attributes are not the same thing as child tags. To access them, assuming you 
have a reference to a node like this:

@test.xpath('//text').each do | text_node |
  puts text_node['font-family']
  puts text_node['stroke']
  ...
end

You can get any attribute of the tag using the square-brackets notation.

Walter

> 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/bcb595d5dd1687f0fceec02c240f1bae%40ruby-forum.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3AD003DB-F36E-4AD7-892B-E97D8A6FE484%40wdstudio.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to