Fix detect struct array, add options for encoding, etc into serializers. add wrapper for handle CData in XmlWriter

Can you add a test for that change or probably have two different PRs, one for CDATA, one for the struct change.