TConverter.Write has a serializer Parameter S : TSerializer that is based on the base class. I can use this successfully to create a JSON payload with Super Object, but when I attempt to use the same code to create an XML Payload (TNativeXML). I get an invalid serializer state error.
Looking into this I can see that there is a RootValue default property for the XML Serializers that is not part of the base class and therefore makes the XML Serializer special in that they cannot be accessed generically.
So for instance when I do the following:
S.BeginArray('SomeName'); The JSON Seriailzer works but the XML Serialzier does not because the XML Serializer is expecting to be used like this.
S['SomeName'].BeginArray('SomeName'); This Root Value property of the XML serializers breaks the generic nature of having and passing a base class to a method like TConverter.DoRead/DoWrite, and requires that I specifically now have code that checks the type of the TSerializer parameter and have a one off code branch that handles this scenario.
IMHO I should be able to use the S: TSerializer variable generically and not perform this function.