Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why isn Python introspection used for XML serialization?

0
Posted

Why isn Python introspection used for XML serialization?

0

Fundamentally there are two approaches one could take to provide XML serialization of objects: 1. The object is unaware of how it might be serialized, instead via introspection and recursion objects are broken down into fundamental types with simple rules on how to encode each fundamental type in XML. 2. The object is XML aware and is in control of exactly what its XML representation is. Option 1 is simple and elegant. Unfortunately it’s not robust. There is no way to control what the final XML representation will be, anything in the object will get serialized, even if its not meant to be part of its portable representation. Python is very forgiving and you can attach any data you want at any time by simply assigning to the object. Such “extra data” might be legitimate internal private use, or it might get attached to the object by programmer error. Either way, it’s not data which should get serialized into its portable representation. The portable representation should be very well de

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.