geopython / geopython/pygeometa

pygeometa.core:pretty-printing XML fails with illegal character - if creation date has '&'

Open
#336 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
127
Forks
52
Avg merge
3d 8h
Merged PRs (30d)
1

Description

Can we provide more background where on yml is the bad character?
Or catch the error?

In below case the error is caused by the '&' character in creation date

[Countryside-survey-of-topsoil-in.yml](https://github.com/user-attachments/files/25965391/Countryside-survey-of-topsoil-in.yml)

Failed to create metadata: Countryside-survey-of-topsoil-in.xml/iso19139 not well-formed (invalid token): line 182, column 42 Traceback (most recent call last):
File "/opt/venv/lib/python3.12/site-packages/pygeometa/core.py", line 450, in render_j2_template
return pretty_print(xml)
^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.12/site-packages/pygeometa/core.py", line 403, in pretty_print
val = minidom.parseString(xml)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/xml/dom/minidom.py", line 1995, in parseString
return expatbuilder.parseString(string)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/xml/dom/expatbuilder.py", line 922, in parseString
return builder.parseString(string)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/xml/dom/expatbuilder.py", line 220, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 182, column 42

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.