XML Serialization
Crystal should have an XML::Serializable module I have a draft that was derived from an API I integrated with.
An example of adding serialization include XML::Serializable.
class Foo
include XML::Serializable
end
One question is what default pattern should be used. Should the values be gathered from the text content or the attributes of the XML document. I was integrating with Rail active model serializes and that puts all the values in the text content.
I think you should be able to customize the the serialization to pull from attributes. example
class Foo
include XML::Serializable
@[XML::Element(src: Attribute)]
end
XML formats seem to have different ways to store types. I dont know if we should serialize and deserialize XML with types in the document.
XML serailzers: YAXLib: text ExtendedXmlSerializer: text XMLEncoder: text with types XmlMapper: text
The library we use at work has a multitude of attributes/annotations to control the exact behavior of how the XML is (de)serialized. E.g. https://jmsyst.com/libs/serializer/master/reference/annotations#xmlattribute which tells the serializer it should (de)serialize the value to/from an attribute versus child node. That could be a good source of inspiration.