prowide-iso20022
prowide-iso20022 copied to clipboard
Create MxPain00800102 message with schemaLocation in Document element
Hello,
is it possible to add a schmemaLocation to the Document element?
E.g.
at the moment I get <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">
my goal is to get <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02 pain.008.001.02.xsd">
Best regards George
My simple workaround is to replace the Document-tag in the resulting message string.
String document = value.document(writeParams);
String updatedDocument = document.replaceFirst(PAIN_DOCUMENT_TAG, PAIN_DOCUMENT_TAG_UPDATED);
Notice for validation purposes you can use a SchemaFactory, and create a Validator for the specific schema. There is no need to modify the actual XML payload to validate it.
Thank you for your comment. My use case is to generate a document with this tags because the service processing the XML needs them.