Hi,
I noticed your format for list definition and created the following script to extract lists. The first step is to have the List definitions from the Onix CodeList xsd. Then change LIST_TO_RETRIEVE and the code list xsd file name appropriately. It's not too clean but I found that it helped me retrieve large lists quite easily (much better than doing it by hand). I hope it helps:
require 'xmlsimple'
xml = XmlSimple.xml_in('code_list.xsd')
LIST_TO_RETRIEVE = "List31"
xml.each do |key, value|
if key.to_s == 'simpleType'
value.each do |v|
if v['name'].downcase == LIST_TO_RETRIEVE.downcase
v['restriction'].each do |a|
list_size = a['enumeration'].size
a['enumeration'].each do |k|
list_size -= 1
val = ''
#puts k['value'] + ' => "' + k['annotation'].class.to_s
if k['value'][0..1] == '00' or k['value'].to_i != 0
val = k['value'].to_i.to_s + ' => "' + k['annotation'][0]['documentation'][0] + '"'
else
val = '"' + k['value'] + '" => "' + k['annotation'][0]['documentation'][0] + '"'
end
val = val + ',' if list_size > 0
puts val
end
end
end
end
end
end
Hi, I noticed your format for list definition and created the following script to extract lists. The first step is to have the List definitions from the Onix CodeList xsd. Then change LIST_TO_RETRIEVE and the code list xsd file name appropriately. It's not too clean but I found that it helped me retrieve large lists quite easily (much better than doing it by hand). I hope it helps:
Thnx for Onix!
-Vivek.