Sha256: e86cbf9e5ce82e0790ea63d4e91aa0eaf61b5c6af8a9252b53372d06a7d6e408
Contents?: true
Size: 640 Bytes
Versions: 1
Compression:
Stored size: 640 Bytes
Contents
# Example of validation of a list of URLs from a local XML sitemap file require 'nokogiri' require 'w3c_validators' include W3CValidators validator = MarkupValidator.new totals = {:errors => 0, :warnings => 0} doc = Nokogiri::XML(File.open("sitemap.xml")) doc.css('loc').collect {|item| item.text}.each do |url| puts "\nValidating markup of #{url}" results = validator.validate_uri(url) puts "#{results.errors.count} errors, #{results.warnings.count} warnings" totals[:errors] += results.errors.count totals[:warnings] += results.warnings.count end puts "\nTOTAL:#{totals[:errors]} errors, #{totals[:warnings]} warnings"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
w3clove-0.0.1 | heatup/04_multiple_validations_from_xml_file.rb |