prowide / prowide-iso20022

Comprehensive business model and parser for all ISO 20022 messages
https://www.prowidesoftware.com
Apache License 2.0
152 stars 68 forks source link

Issue while Parsing MxPacs00800103 (XML namespace without identifier in "any" field of Signature Envolope) #43

Open graghsaka opened 2 years ago

graghsaka commented 2 years ago

I am facing issue while parsing AppHdr (BusinessAppHdrV01), specifically Sgntr (SignatureEnvelope).

In SignatureEnvelope there's a field "any" which is annotated by @XmlAnyElement.

My Xml string has a custom tag "XmlSgntr". So while parsing xml string, this "any" field is set as my custom tag. This is fine. But the problem is when my custom tag has XML namespace (xmlns), then it won't set. That is "any" field is set to null. This happens only when I set _xmlns="https://acb/chjhj"**_, but everything works fine when i set it as xmlns:xsi="https://acb/chjhj"**. i.e issue only exists when I set xml namespace without identifier (when xmlns value is URI).

What the reason behind this behaviour?

Edit: So I debugged, and found another finding. This only happens if use xmlns="https://acb/chihj". If change it to xmln="https://acb/chih" or maybe anything else. That is I changed "xmlns" (namespace name). Seems like "xmlns" is causing the issue.

My Header: <AppHdr xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:head.001.001.01 head.001.001.01.xsd" xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

My Signarure: <XMLSgntrs xmlns="http://www.w3.org/2000/09/xmldsig#">

zubri commented 2 years ago

We probably need a type adapter to handle the Any elements. This is a long time pending issue.

As for the namespace, it is a bit strange, since the one that you said it works ant the other do not have significant differences.

zubri commented 2 years ago

This issue is similar to #39 and #41

Test case and a few exploration approaches have been pushed to: https://github.com/prowide/prowide-iso20022/pull/48

XmlAnyElement is expected to be parsed into a generic Element node.

The root cause is probably in our NamespaceAndElementFilter and MxReadImpl classes. But could not find a solution to fit al scenarios yet.

graghsaka commented 2 years ago

pacs08.txt

@zubri thanks. I have also attached my xml request for reference