Sha256: 3d4a994821aa62d955bb18d6d07b55efa1612b87f696f12a684fec54f363ba96

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

# Example of validation of a list of URLs from a text file

require 'w3c_validators'
include W3CValidators
validator = MarkupValidator.new

totals = {:errors => 0, :warnings => 0}
File.open("urls.txt", "r") do |file|
  file.each_line 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
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/03_multiple_validation_from_text_file.rb