Ruby: XmlSimple strange behavior or doing it wrong?
require 'rubygems'
require 'xmlsimple'
data = XmlSimple.xml_in("<Product><ProductId>12341234</ProductId><Title>Some text here, 11234. and here, 234. and here </Title>开发者_Go百科;</Product>")
puts data['Title'].is_a? Array
Why it's an array instead of string? O_o
Thanks ;)
Use:
data = XmlSimple.xml_in yourxml, { 'ForceArray' => false}
The options is true
by default because normally you want nested elements be folded into hashes.
精彩评论