benbalter / sitemap-parser

Ruby Gem to parse sitemaps.org compliant sitemaps
MIT License
29 stars 46 forks source link

Local sitemap with relative path doesn't work #14

Open tsmsogn opened 7 years ago

tsmsogn commented 7 years ago

Hi.

I faced the following error when I tried to parse sitemap in local.

require 'sitemap-parser'

sitemap = SitemapParser.new File.join(File.dirname(__FILE__), 'sitemap.xml')
puts sitemap.to_a
#=> http://ben.balter.com/
#=> http://ben.balter.com/about/
#=> http://ben.balter.com/contact/

sitemap = SitemapParser.new 'sitemap.xml'
puts sitemap.to_a
#=> Malformed sitemap, no urlset (RuntimeError)