While spark-xml will never infer MapType for an element, it can parse an XML element and its children as a map if given to do so in a schema. Each child element and its value becomes a key-value pair in the map. However, currently, attributes of the parent node are ignored. It would be more consistent to add them as key-value pairs in the map as well, because if it were inferred as a struct, then attributes and values would appear as fields.
While spark-xml will never infer MapType for an element, it can parse an XML element and its children as a map if given to do so in a schema. Each child element and its value becomes a key-value pair in the map. However, currently, attributes of the parent node are ignored. It would be more consistent to add them as key-value pairs in the map as well, because if it were inferred as a struct, then attributes and values would appear as fields.