1- # xml2pyton
1+ # xml2python
22
33Takes XML input and converts it to a dict. The output can be optimized by removing unnecessary nesting or ensuring lists
4- in ambiguous cases, so you can easily handle it afterwards, eg in [ validataclass] ( https://pypi.org/project/validataclass/ ) .
4+ in ambiguous cases, so you can easily handle it afterwards, e.g. in [ validataclass] ( https://pypi.org/project/validataclass/ ) .
55
66## Usage
77
@@ -52,7 +52,7 @@ Without the optional arguments, this:
5252```
5353
5454
55- ### Parameter ` ensure_array_keys `
55+ ### Parameter: ` ensure_array_keys `
5656
5757The ` ensure_array_keys ` list can be provided to specify for which keys in which tags, the values
5858should always be interpreted as items of a list. In case there is only one child item, they would otherwise
@@ -86,7 +86,7 @@ the example above would be converted to this, interpreting the values of the giv
8686```
8787
8888
89- ### Parameter ` remote_type_tags `
89+ ### Parameter: ` remote_type_tags `
9090
9191The ` remote_type_tags ` list can be provided to specify which tags should be interpreted as names of types,
9292e.g. enums, which don't need to be preserved as keys in the output dict.
@@ -155,7 +155,10 @@ but only one of them should be skipped, for example:
155155can be parsed into a non-nested field named 'resultCode' with the content 'ok'
156156by giving ` conditional_remote_type_tags=[('resultCode', 'resultCode')] ` .
157157
158- The 'ignore_attributes' list can be given to avoid parsing attributes with a certain name.
158+
159+ ### Parameter: ` ignore_attributes `
160+
161+ The ` ignore_attributes ` list can be given to avoid parsing attributes with a certain name.
159162This is useful if a tag could either have a simple string value as a child, or be self-closing -
160163and the self-closing version should be interpreted as if the tag's value is null
161164(because there might be attributes that say this, but in a weirdly complicated way).
@@ -180,7 +183,7 @@ And if we were to just skip the attribute by adding it to `remote_type_tags`, we
180183
181184Which would be very misleading. So to parse this tag into a useful value for an 'Optional[ str] ' type field,
182185the ignore_attributes list can be used.
183- With ignore_attributes=[ '{http://www.w3.org/2001/XMLSchema-instance}nil' ] , we get a result that fits the type:
186+ With ` ignore_attributes=['{http://www.w3.org/2001/XMLSchema-instance}nil'] ` , we get a result that fits the type:
184187
185188```
186189'resultDescription': None
0 commit comments