mirror of https://github.com/tdwg/dwc.git
Solution to quotes in content of XML attributes.
This commit is contained in:
parent
bcf6552515
commit
e879849ce5
|
@ -11,7 +11,7 @@
|
||||||
# One extension can be generated per run of the script, with the extension's name and
|
# One extension can be generated per run of the script, with the extension's name and
|
||||||
# destination file as parameters (see main() for syntax).
|
# destination file as parameters (see main() for syntax).
|
||||||
#
|
#
|
||||||
__version__ = '2023-07-07T22:22-03:00'
|
__version__ = '2023-07-09T12:46-03:00'
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
import sys
|
import sys
|
||||||
|
@ -610,12 +610,11 @@ class CSVtoXMLConverter:
|
||||||
term_xml += f'required="true"/>'
|
term_xml += f'required="true"/>'
|
||||||
else:
|
else:
|
||||||
term_xml += f'required="false"/>'
|
term_xml += f'required="false"/>'
|
||||||
|
|
||||||
xml += f' {term_xml}\n'
|
xml += f' {term_xml}\n'
|
||||||
for addition in extension.get("gbif_additions"):
|
for addition in extension.get("gbif_additions"):
|
||||||
xml += f' {addition}'
|
xml += f' {addition}'
|
||||||
xml += "</extension>"
|
xml += "</extension>"
|
||||||
return xml
|
return encoded_quotes(xml)
|
||||||
|
|
||||||
def write_xml(self, extension_name, filename):
|
def write_xml(self, extension_name, filename):
|
||||||
'''
|
'''
|
||||||
|
@ -625,6 +624,9 @@ class CSVtoXMLConverter:
|
||||||
with open(filename, 'w') as xml_file:
|
with open(filename, 'w') as xml_file:
|
||||||
xml_file.write(self.get_xml(extension_name))
|
xml_file.write(self.get_xml(extension_name))
|
||||||
|
|
||||||
|
def encoded_quotes(s):
|
||||||
|
return s.replace('"', '"')
|
||||||
|
|
||||||
def _getoptions():
|
def _getoptions():
|
||||||
''' Parse command line options and return them.'''
|
''' Parse command line options and return them.'''
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
Loading…
Reference in New Issue