开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜