class PmdTester::ProjectsParser
The ProjectsParser
is a class responsible of parsing the projects XML file to get the Project
object array
Public Instance Methods
parse(list_file)
click to toggle source
# File lib/pmdtester/parsers/projects_parser.rb, line 9 def parse(list_file) schema = Nokogiri::XML::Schema(File.read(schema_file_path)) document = Nokogiri::XML(File.read(list_file)) errors = schema.validate(document) raise ProjectsParserException.new(errors), "Schema validate failed: In #{list_file}" unless errors.empty? projects = [] document.xpath('//project').each do |project| projects.push(Project.new(project)) end projects end
schema_file_path()
click to toggle source
# File lib/pmdtester/parsers/projects_parser.rb, line 23 def schema_file_path ResourceLocator.locate('config/projectlist_1_2_0.xsd') end