... sanitizing xml, srip xml from special chars
strip XML from ^C
(control C)
value = value.encode(:xml => :text) # remove &<>
"<node attr=#{my_string.encode(:xml => :attr)} />"
# => <node attr="this is "my" complicated <String>" />
"<node>#{my_string.encode(:xml => :text)}</node>"
# => <node>this is "my" complicated <String></node>
more : https://gist.github.com/coffeejunk/3827905
value = value.gsub(/\002|\003/, '') # remove ^C
def secure_xls_cell(cell_value)
cell_value[0] = "'=" if cell_value[0] == '='
cell_value
end
in ruby
Nokogiri::XML('foo').errors
in linux
xmllint my_file.xml