0
我有这样的XMLnokogiri slop模式如何处理破折号分隔的元素?
<league xmlns="http://feed.elasticstats.com/schema/basketball/schedule-v2.0.xsd" id="4353138d-4c22-4396-95d8-5f587d2df25c" name="NBA" alias="NBA">
<season-schedule id="eb322501-7291-457b-9bbb-b4106ecf9564" year="2014" type="PRE">
<games>
...
如何才能获得“赛季时间表”的内容
到目前为止,我已经尝试了这些没有任何成功:
doc2.html.body.league.seasonschedule
NoMethodError: undefined method `seasonschedule' for #<Nokogiri::XML::Element:0x007faddf5ce2b8>
from /Users/boti/.rvm/gems/[email protected]/gems/nokogiri-1.6.3.1/lib/nokogiri/decorators/slop.rb:30:in `method_missing'
[13] pry(main)> doc2.html.body.league.season_schedule
NoMethodError: undefined method `season_schedule' for #<Nokogiri::XML::Element:0x007faddf5ce2b8>
from /Users/boti/.rvm/gems/[email protected]/gems/nokogiri-1.6.3.1/lib/nokogiri/decorators/slop.rb:30:in `method_missing'
':赛季schedule'将无法正常工作,你需要用':“赛季时间表”'或'刚“season-schedule”避免将'-'解释为负数。 – matt 2014-10-08 13:54:28
@matt - 很自然,谢谢你纠正它。 – BroiSatse 2014-10-08 14:01:00