Yeah, I was thinking about that too, but it is impossible in general with the semantics I have used (particularly with enums), because they are really meant to make sense from weird XML structures (something that came up repeatedly in my day job).
Take the following:
enum InputElement {
@:if(x.getAttribute('type') == 'checkbox') Checkbox(c:{ @:optional @:attr var checked:Bool; });
@:if(x.getAttribute('type') == 'text') Textfield(c:{ @:optional @:attr var placeholder:String; });
}
To be able to XMLize that back you would need additional information and it is close to impossible to statically ensure that an XML node would survive a roundtrip. In fact the library rather aims at extracting whatever information you think is relevant, as opposed to preserving all the data from the XML (I actually developed this in a project where we were using an "API" where you could get two XMLs each a couple of MBs in size, and our cache shrunk to 200kb of haxe serialized data).
But I do see the usefulness of what you're asking for. Please dump any more concrete ideas you might have in the issue tracker ;)
Best,
Juraj