Merge pull request #133 from eLBati/10.0-camt054

[10.0] allow camt054 to be parsed
This commit is contained in:
Alexis de Lattre
2018-02-20 14:26:52 +01:00
committed by GitHub
3 changed files with 8 additions and 6 deletions

View File

@@ -222,22 +222,24 @@ class CamtParser(models.AbstractModel):
)
if not re_camt.search(ns):
raise ValueError('no camt: ' + ns)
# Check wether version 052 or 053:
# Check wether version 052 ,053 or 054:
re_camt_version = re.compile(
r'(^urn:iso:std:iso:20022:tech:xsd:camt.053.'
r'(^urn:iso:std:iso:20022:tech:xsd:camt.054.'
r'|^urn:iso:std:iso:20022:tech:xsd:camt.053.'
r'|^urn:iso:std:iso:20022:tech:xsd:camt.052.'
r'|^ISO:camt.054.'
r'|^ISO:camt.053.'
r'|^ISO:camt.052.)'
)
if not re_camt_version.search(ns):
raise ValueError('no camt 052 or 053: ' + ns)
raise ValueError('no camt 052 or 053 or 054: ' + ns)
# Check GrpHdr element:
root_0_0 = root[0][0].tag[len(ns) + 2:] # strip namespace
if root_0_0 != 'GrpHdr':
raise ValueError('expected GrpHdr, got: ' + root_0_0)
def parse(self, data):
"""Parse a camt.052 or camt.053 file."""
"""Parse a camt.052 or camt.053 or camt.054 file."""
try:
root = etree.fromstring(
data, parser=etree.XMLParser(recover=True))