How does the converter handle XML attributes vs elements?
XML attributes (e.g. <book id="bk101">) become dataclass fields tagged with field(metadata={"xml_attr": "id"}). Element children become plain typed fields. The metadata makes the attribute origin explicit so xmltodict (which prefixes attribute keys with "@") and dataclass-wizard can both populate the model from the parsed dict.
Can I use lxml or xmltodict with the generated dataclasses?
Both work. xmltodict.parse(xml) returns a nested dict where attributes are keyed "@attr" and text content under "#text" — map those into the dataclass with a small from_dict helper or dataclass-wizard. With lxml, walk the ElementTree and call YourClass(**fields) per element. The generated metadata documents which fields came from attributes.
What Python version is required?
Dataclasses require Python 3.7+. The generated code uses typing.List and typing.Optional which work on any 3.7+ version. On Python 3.9+ you can replace List[X] with list[X] and Optional[X] with X | None for shorter syntax.
Does the output handle XML namespaces?
Element names are stripped of namespace prefixes by default (so soap:Body becomes body). To preserve namespace info, edit the metadata to add an xml_ns key, or read namespaces directly from element.tag in lxml. xmltodict preserves namespaces in keys when process_namespaces=False.
How are repeated elements handled?
When the converter sees the same child element twice (<tag>python</tag><tag>programming</tag>), the field becomes List[Tag] or List[str] depending on whether the children have their own structure. For single-occurrence elements this is just the leaf type — re-run the converter against XML where the field repeats to see the array typing.
Why use dataclasses instead of pydantic?
Dataclasses are stdlib (no extra dependency) and lighter at runtime. If you want validation and JSON Schema generation, copy the field declarations into a pydantic BaseModel or use pydantic.dataclasses.dataclass — same field syntax, same metadata, plus pydantic features.
Are elements with attributes and text content modeled?
Yes. <price currency="USD">39.99</price> generates a Price class with currency: str (xml_attr metadata) and text: float (xml_text metadata). xmltodict represents the same structure as {"@currency": "USD", "#text": "39.99"} which maps directly to the two fields.
Is the XML I paste sent to your servers?
No. Parsing and code generation run entirely in JavaScript inside your browser via the built-in DOMParser. Open DevTools → Network and confirm: clicking Convert produces zero HTTP requests. Safe for SOAP responses, configuration files, or any XML containing secrets.