now when i want to get the labels form the file
i was used non professional way to get them
buy using this code
f=File.open(@svgFile)
@data=Nokogiri::XML(f)
@data=@data.to_s # convert to string
@data=@data.split('<text')[1..-1] # convert to array and remove first
element
f.close
now when i want to get the labels form the file
i was used non professional way to get them
buy using this code
f=File.open(@svgFile)
@data=Nokogiri::XML(f)
@data=@data.to_s # convert to string
@data=@data.split('<text')[1..-1] # convert to array and remove first
element
f.close
so now if i want to get the full data to every element such as
name= First label
stroke =#000000
font-size=24
how i can get the child data in the svg file with professional code
i don't like the way to remove html tags to get the data ???
You're starting out on the right track, using Nokogiri. You don't need to use string manipulation, though, because SVG is just XML inside, so you can interrogate the actual data structure in Noko using either xpath or css syntax. Have a quick read through the Nokogiri documentation at http://nokogiri.org or google the topic.