4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/middleman/xmlvalidator/extension.rb', line 4
def registered(app)
require 'nokogiri'
app.after_build do |builder|
puts "", "Validating with NokoGiri", ""
Dir.glob("build/**/*BingSiteAuth.xml").each do |full_path|
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, 'BingSiteAuth.xsd') == true ? "COMPLETE".green : "ERRORS FOUND".red)
Xmlvalidator.validate(full_path, 'BingSiteAuth.xsd').each do |error|
puts " " + error.message
end
end
Dir.glob("build/**/*crossdomain.xml").each do |full_path|
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, 'crossdomain.xsd') == true ? "COMPLETE".green : "ERRORS FOUND".red)
Xmlvalidator.validate(full_path, 'crossdomain.xsd').each do |error|
puts " " + error.message
end
end
Dir.glob("build/**/*Sitemap.xml").each do |full_path|
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, 'Sitemap3.xsd') == true ? "COMPLETE".green : "ERRORS FOUND".red)
Xmlvalidator.validate(full_path, 'Sitemap3.xsd').each do |error|
puts " " + error.message
end
end
Dir.glob("build/**/*.rss").each do |full_path|
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, 'RSSSchema.xsd') == true ? "COMPLETE".green : "ERRORS FOUND".red)
Xmlvalidator.validate(full_path, 'RSSSchema.xsd').each do |error|
puts " " + error.message
end
end
Dir.glob("build/**/*.xml").each do |full_path|
if not (full_path.match(/^.*BingSiteAuth.xml$/) || full_path.match(/^.*crossdomain.xml$/) || full_path.match(/^.*Sitemap.xml$/))
puts " validating".blue + " #{full_path}....." + (Xmlvalidator.valid(full_path, 'XMLSchema.xsd') == true ? "COMPLETE".green : "ERRORS FOUND".red)
Xmlvalidator.validate(full_path, 'XMLSchema.xsd').each do |error|
puts " " + error.message
end
end
end
puts "", "Validation with NokoGiri " + "Complete".green, ""
end
end
|