Skip to content

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

@pvgenuchten

Description

@pvgenuchten

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions