10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/national_rail_wrapper/feeds/knowledge_base/parsers/tocs.rb', line 10
def to_json
options = Nokogiri::XML::ParseOptions.new.nonet.noent.noblanks.huge
doc = Nokogiri::XML.parse(@data, nil, nil, options)
doc.xpath('/xmlns:TrainOperatingCompanyList/xmlns:TrainOperatingCompany').map do |toc_node|
{
name: toc_node.css('Name')&.text,
atoc_code: toc_node.css('AtocCode')&.text,
atoc_member: toc_node.css('AtocMember')&.text,
legal_name: toc_node.css('LegalName')&.text,
station_operator: toc_node.css('LegalName')&.text,
managing_director: toc_node.css('ManagingDirector')&.text,
logo: toc_node.css('Logo')&.text,
network_map: toc_node.css('NetworkMap')&.text,
company_website: toc_node.css('CompanyWebsite')&.text
}
end
end
|