generating xsi:nil attribute using documentToXMLString

I’m using 6.0.1 SP2. Does anyone know if documentToXMLString can generate the xsi:nil attribute? Eg:


xsi:nil indicates that the tag is nillable but the element tag is required (as opposed to making the element tag optional). Ideally, documentToXMLString should generate this xsi:nil attribute if the value of reasonCode element is null. However, documentToXMLString either leave out the tag completely or generate it as , depending on the value of generateRequiredTags setting.

One workaround I have is to create the @xsi:nil and *body as strings in the reasonCode subdocument, but this is makes my flow mapping more complicated, as I have to check if reasonCode is null to set @xsi:nil to true!

Any ideas?

In my case I want optional elements to be omitted when the value of the document field is $null.

You said that you get this effect with documentToXMLString but the “generateRequiredTags” parameter of documentToXMLString does not seem to affect optional elements in my case. This is also what the wM “Build in service reference” says.

How did you get optional elements with $null value to disappear?