How does the output use struct tags for attr vs element?
Element children get `xml:"name"` tags. Attributes get `xml:"name,attr"` — the ,attr modifier tells encoding/xml to read from the attribute table on the parent element instead of looking for a child element of the same name. Element text content uses `xml:",chardata"`. The single tag syntax keeps all metadata on the field declaration where Go developers expect it.
Is the output compatible with encoding/xml?
Yes — encoding/xml is the only XML library targeted. Decode with xml.Unmarshal(data, &root) where root is a *Root pointer; the tagged fields are populated automatically. The same struct round-trips via xml.Marshal so you can produce equivalent XML on output.
How does it handle the root element name?
The top-level struct includes an XMLName xml.Name field tagged with the source root element name. encoding/xml uses this on both Marshal and Unmarshal to bind the correct element. If you rename the struct you do not need to rename the XML — just keep the tag.
How are repeated elements handled?
Repeated child elements like <tag>...</tag> become a slice []TagType on the parent struct. encoding/xml automatically appends each occurrence to the slice. Empty input produces a nil slice; one element produces a slice of length one.
What about XML namespaces?
Namespace-qualified elements use the full xml:"namespace-uri name" tag form. The basic generator strips prefixes; for namespaced unmarshalling rewrite the tag as `xml:"http://example.com/ns localname"` and encoding/xml will match the namespace correctly.
Can elements with attributes and text content be modeled?
Yes. <price currency="USD">39.99</price> generates a struct with two fields — Currency tagged `xml:"currency,attr"` and a Value field tagged `xml:",chardata"`. encoding/xml populates the text body into the chardata field while reading the attribute separately.
Is the XML I paste sent to your servers?
No. XML is parsed by the browser DOMParser and the Go 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 unmarshal XML into the generated struct?
Use encoding/xml: var book Book; if err := xml.Unmarshal([]byte(data), &book); err != nil { log.Fatal(err) } — the tagged fields are populated automatically. For streaming use xml.NewDecoder(reader).Decode(&book), which is preferable for large documents.