Paste a sample XML document and generate matching TypeScript interfaces, Java classes, or C# classes — with nested types, arrays for repeated elements, and optional fields inferred automatically.
About this tool
This generator reads the structure of an XML document the same way a person would: it looks at which elements repeat (those become arrays), which ones are missing in some instances but not others (those become optional), which values look like numbers, booleans, or dates (those get typed accordingly), and which elements nest inside others (those become their own separate type, referenced from the parent). It's not doing text replacement on your XML — it builds a structural model first, then emits one of three target languages from that same model, which is why nested elements, arrays, and attributes all come out as properly separate, independently named types rather than one flat blob.
What becomes what
| XML value | Inferred type |
| 15 | integer |
| 49.99 | decimal |
| true / false | boolean |
| 2026-01-15 | date |
| 2026-01-15T09:30:00Z | dateTime |
| anything else | string |
An attribute on an element becomes a field alongside that element's child-element fields. If an attribute and a child element happen to share the same name (an id attribute next to a <id> child, for instance), the attribute's generated field name gets an Attr suffix so the two don't collide — the underlying XML name used for serialization stays exactly as it was in your document either way.
Language-specific choices
TypeScript generates interface declarations. Dates come through as string (an ISO-8601 value, not a runtime Date object), since that's what actually round-trips through JSON/XML without a parsing step you'd have to add yourself.
Java generates plain POJO classes with private fields and generated getters/setters — no Lombok, no framework assumptions. Optional numeric and boolean fields use boxed wrapper types (Integer, Boolean) instead of primitives, since Java primitives can't represent "missing." Dates map to java.time.LocalDate / LocalDateTime.
C# generates classes with auto-implemented properties ({ get; set; }). Optional value types get a ? nullable suffix (int?, bool?, DateTime?) when the "Nullable optional fields" option is on.
Turning on Serialization attributes adds @XmlElement/@XmlAttribute/@XmlRootElement (Java, JAXB-style) or [XmlElement]/[XmlAttribute]/[XmlRoot] (C#, System.Xml.Serialization) so the generated class can serialize back to XML using each language's standard library, preserving the original element and attribute names even when a different naming convention is applied to the generated field names. TypeScript has no built-in equivalent, so this option has no effect there.
Everything runs locally in your browser using the built-in XML parser; nothing you paste or upload is sent to a server.
Frequently asked questions
How does it decide a field is optional or an array?
By comparing multiple instances of the same parent element in your sample. If a child element is missing from at least one instance, its field is marked optional; if it appears more than once in any instance, its field becomes an array.
What happens with deeply nested XML?
Each element that has its own attributes or child elements becomes its own separate type, referenced from its parent — nesting depth isn't limited, though very deep or irregular structures are worth reviewing manually.
Why is a field typed as "string" when I expected a number?
Type inference requires every observed value for that field to match a numeric pattern. If even one instance in your sample has a non-numeric value (including an empty value), the field falls back to string, since that's the type that's always safe.
Can I use different naming conventions per language?
The tool applies one naming convention at a time to the field or property names in whichever language you're currently viewing — C# properties are always PascalCase by convention regardless of the setting, since that's idiomatic C# and matches what { get; set; } auto-properties look like in virtually all real C# code.
What do the serialization attributes actually do?
They tell Java's JAXB or C#'s System.Xml.Serialization namespace which XML element or attribute name a field corresponds to, so the generated class can be serialized back to XML — or deserialized from it — using each language's standard library, even if the field name itself was changed by a naming convention.
Why doesn't TypeScript get serialization attributes?
TypeScript/JavaScript has no built-in XML serialization framework equivalent to JAXB or System.Xml.Serialization, so there's no standard attribute syntax to generate. The interfaces are still fully usable with any XML parsing library you choose.
What happens if an attribute and a child element have the same name?
The generated field for the attribute gets an Attr suffix added to avoid a naming collision with the child element's field. The actual XML attribute name used by serialization attributes is unaffected — it always reflects your original XML.
Does this validate my XML?
It checks that your XML is well-formed enough to parse (a malformed document will show a clear error), but it doesn't validate against a schema. For that, see the XML Formatter & Validator.
Does my XML get uploaded anywhere?
No. Parsing and code generation both happen locally in your browser, including files you upload or drag in. Nothing is sent to a server.
Is there a file size limit?
No hard limit is enforced, but very large or deeply nested files take longer to analyze and may produce a large number of generated types to review.