I am using the XmlSerializer from xsdata to convert a python3.9 dataclass object into XML.
This is the code
# create serializer
XML_SERIALIZER = XmlSerializer(config=SerializerConfig(xml_declaration=False))
# initialize class with multiple properties
my_obj = MyDataClass(prop1='some val', prop2='some val' , , ,)
# serialize object
serialized_value = XML_SERIALIZER.render(my_obj)
This generates an xml representation of the object but with things I don't want in the xml like this xmlns... xsi:type
<SomeProperty xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SomeTypePropetryInMyDataClass">
<code>
XYZ
</code>
</SomeProperty>
I tried render like this too XML_SERIALIZER.render(my_obj, ns_map=None), but that didn't work either.
Does anyone know how to render that without the namespaces and type information added? Is there another XML serializer/deserializer for python that is more flexible?