XML deserialize iso 20022 pain.001.001.03 from xsd using c# -
i want object xml file. in example using iso 2002 pain.001.001.03
i have downloaded schema from
and xml file from
i have validated xml against xsd using tool
i have generated class using xsd
and using code below in order deserialize
xmlserializer ser = new xmlserializer(typeof(customercredittransferinitiationv03), new xmlrootattribute { elementname = "document", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03", }); filestream myfilestream = new filestream("c:\\001.001.03\\pain.001.001.03.xml", filemode.open); customercredittransferinitiationv03 myobject = (customercredittransferinitiationv03) ser.deserialize(myfilestream);
the code return null values xml has values
<?xml version="1.0" encoding="utf-8"?> <document xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"> <cstmrcdttrfinitn>
the root element document
, , not cstmrcdttrfinitn
:
var serializer = new xmlserializer(typeof(document)); using (var file = file.openread(path)) { var document = (document)serializer.deserialize(file); var transfer = document.cstmrcdttrfinitn; }
Comments
Post a Comment