Below is a code snippet of creating a document:
CdtrAcct = new CdtrAcct
{
Id = new Id
{
IBAN = iban,
Othr = new Othr
{
Id = creditBankAcct
},
},
},
If the IBAN field has a value, then Id is null. However, when the XML file is formed, I get the below:
<CdtrAcct>
<Id>
<IBAN>XXXXXXXXXXXXXXXXXXX</IBAN>
<Othr />
</Id>
</CdtrAcct>
The problem that I have is that the software that reads the XML cannot process the whitespace here: <Othr />. What do I need to do to get <Othr/>?
C# code:
XmlSerializer serializer = new XmlSerializer(typeof(Document));
var textWriter = new StreamWriter(@"C:\BankFiles\Outbox\" + filename + ".xml");
serializer.Serialize(textWriter, config);
textWriter.Close();
Convert the XML to a string (e.g.
myString), then you can replace" \>"with"\>"by usingAfterwards you can print it into a file.
Of course this is a workaround / hack and getting the buggy software fixed should be the first try. However, this should solve your problem immediately.