Skip to content

Commit e879849

Browse files
committed
Solution to quotes in content of XML attributes.
1 parent bcf6552 commit e879849

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build/buildxml.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# One extension can be generated per run of the script, with the extension's name and
1212
# destination file as parameters (see main() for syntax).
1313
#
14-
__version__ = '2023-07-07T22:22-03:00'
14+
__version__ = '2023-07-09T12:46-03:00'
1515

1616
import csv
1717
import sys
@@ -610,12 +610,11 @@ def get_xml(self, extension_name):
610610
term_xml += f'required="true"/>'
611611
else:
612612
term_xml += f'required="false"/>'
613-
614613
xml += f' {term_xml}\n'
615614
for addition in extension.get("gbif_additions"):
616615
xml += f' {addition}'
617616
xml += "</extension>"
618-
return xml
617+
return encoded_quotes(xml)
619618

620619
def write_xml(self, extension_name, filename):
621620
'''
@@ -625,6 +624,9 @@ def write_xml(self, extension_name, filename):
625624
with open(filename, 'w') as xml_file:
626625
xml_file.write(self.get_xml(extension_name))
627626

627+
def encoded_quotes(s):
628+
return s.replace('"', '&quot;')
629+
628630
def _getoptions():
629631
''' Parse command line options and return them.'''
630632
parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)