Okay, I have found an answer, somewhat to this one, but wanted to put it here in case someone else finds it useful or has any further information.
We are using Powerbuilder 12.5.2 Build 5583 Classic and we are exporting a datawindow to XML using this code:
ads.Object.DataWindow.Export.XML.MetaDataType = XMLSchema!
ads.Object.DataWindow.Export.XML.SaveMetaData = MetaDataExternal!
ls_validation_xml = ads.Object.DataWindow.Data.XML
Now one of the columns in ads is a long, and is set to null. However after the export the value in the XML is set to zero. The datawindow is a web services datawindow and that particular column has nillable="True", not sure if any of that matters but it may.
The way to fix this, and it sounds stupid to me, but I really tested it and it is true, is to add the column to the detail band, possibly any band, if it wasn't already there.
Basically if you have a datastore like I did that is never viewed by the user and therefore has no controls on it at all the export doesn't quite work properly! It seems strange to me, but if anyone has any explanations as to why this is so, and / or feels there is a good reason for it to act this way, please let me know so I can understand and document it.
Thanks.