Does it use XMLCoder for attribute mapping?
Yes — the generated structs are designed for XMLCoder (github.com/CoreOffice/XMLCoder), the most widely used Swift XML Codable library. CodingKeys map property names to source XML names; attributes are detected by the leading @ in the source. To mark a key as an attribute at decode time, conform CodingKey to XMLCoderKey via DynamicNodeDecoding and return .attribute for those keys.
What if I do not want a third-party dependency — can I use Apple's XMLParser?
Yes, but XMLParser is a SAX-style delegate API that does not consume Codable structs. You would write a delegate manually that produces these structs. The generated Codable structs still serve as the target type — only the decoding plumbing changes.
How are XML attributes mapped to Swift properties?
XML attributes (e.g. <book id="bk101">) become let properties with a CodingKeys case mapping the Swift name to the XML attribute name. With XMLCoder, override DynamicNodeDecoding on the parent struct and return .attribute for these keys; otherwise the decoder defaults to treating them as elements.
How are repeated elements like <tag> in <tags> represented?
Repeated child elements become an Array property ([TagType]) on the parent struct. XMLCoder collects each occurrence into the array. For wrapped lists you can model an inner Tags struct that contains the array, mirroring the XML hierarchy exactly.
What about XML namespaces?
XMLCoder accepts namespace-qualified element names through CodingKeys. Use the full ns:localname string as the raw value (case bookId = "ex:book"). The basic generator strips namespaces; rewrite the CodingKeys raw values to round-trip namespaced documents.
Can elements with both attributes and text content be modeled?
Yes. <price currency="USD">49.99</price> generates a Price struct with two properties — currency mapped via CodingKey and a value field mapped to "" (the XMLCoder convention for text content). Combined with DynamicNodeDecoding, the decoder splits attribute and text body correctly.
Is the XML I paste sent to your servers?
No. XML is parsed by the browser DOMParser and the Swift code is generated entirely in JavaScript on your machine. Open DevTools → Network and you will see no requests when you click Convert. Safe for SOAP responses and configuration files containing API keys or credentials.
How do I decode XML into the generated struct?
With XMLCoder: let book = try XMLDecoder().decode(Book.self, from: data) — the Codable conformance plus CodingKeys are populated automatically. Add XMLCoder to your Package.swift: .package(url: "https://github.com/CoreOffice/XMLCoder.git", from: "0.17.0").