Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ckanext/spatial/harvesters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ def _get_content_as_unicode(self, url):
content = response.text

# Remove original XML declaration
content = re.sub('<xml(.*)>', '', content)
content = re.sub(r"<\?xml(.*)\?>", "", content)

# Get rid of the BOM and other rubbish at the beginning of the file
content = re.sub('.*?<', '<', content, 1)
Expand All @@ -872,7 +872,7 @@ def _validate_document(self, document_string, harvest_object, validator=None):
if not validator:
validator = self._get_validator()

document_string = re.sub('<xml(.*)>', '', document_string)
document_string = re.sub(r"<\?xml(.*)\?>", "", document_string)

try:
xml = etree.fromstring(document_string)
Expand Down
2 changes: 1 addition & 1 deletion ckanext/spatial/harvesters/csw.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def fetch_stage(self,harvest_object):
# Save the fetch contents in the HarvestObject
# Contents come from csw_client already declared and encoded as utf-8
# Remove original XML declaration
content = re.sub('<xml(.*)>', '', record['xml'])
content = re.sub(r"<\?xml(.*)\?>", "", record["xml"])

harvest_object.content = content.strip()
harvest_object.save()
Expand Down
Loading