Open yan-hic opened 4 years ago
Currently parsing a XML renders string values only, so xmltodict cannot be used e.g. as input of fastavro if the avro schema has a mix of data types.
xmltodict
fastavro
Enhancement request is to have a optional argument like forced_list but for (key, datatype) tuples or similar syntax. The comment https://github.com/martinblech/xmltodict/pull/104#issuecomment-104944964 would actually meet both requirements.
forced_list
Alternative: write complex post-processing function.
Note another library, xmlschema, uses the datatypes defined in a xml schema file, if available. But this is much slower than xmltodict especially if only a few fields should be force-converted.
xmlschema
Facing same issue.
Currently parsing a XML renders string values only, so
xmltodict
cannot be used e.g. as input offastavro
if the avro schema has a mix of data types.Enhancement request is to have a optional argument like
forced_list
but for (key, datatype) tuples or similar syntax. The comment https://github.com/martinblech/xmltodict/pull/104#issuecomment-104944964 would actually meet both requirements.Alternative: write complex post-processing function.
Note another library,
xmlschema
, uses the datatypes defined in a xml schema file, if available. But this is much slower thanxmltodict
especially if only a few fields should be force-converted.