Skip to content

Languages#

Choose the ecosystem you are using:

For shared CLI options and code generation, see the schema compiler guide.

Choose a starting point#

All seven targets can generate models from XSD with polyxml generate. The default backend is the recommended starting point; enable the extras only when your project needs them. Use a separate [[generate]] entry per target in polyxml.toml when options differ between languages.

Target Default generated models Optional code generation
Rust Native Rust types with streaming XML codecs phf dispatch; owned strings with --zero-copy=false; topological chunking with --split-units
Python Dataclasses with slots and keyword-only fields Pydantic v2 backend; slots and kw-only for dataclasses
C++20 Header-based types C++ modules (--mode modules); Glaze metadata
Go Go structs with XML and JSON tags EasyJSON annotations; Sonic tags (see the current limitation)
TypeScript / Node.js TypeScript interfaces Zod, Valibot, or TypeBox schemas
WebAssembly Browser, Edge & Node runtime (@polyxml/wasm) Streaming parseStream, schema validation, zero-dependency Wasm
Java Java records POJOs, builders, direct XML codecs, Jackson 2/3, Spring Boot 4
C# Record classes Mutable classes, record structs, source generation

The compiler guide lists the exact backend, style, and feature values accepted by the CLI. For parsing and serialization from application code, start with your language guide. For command-line generation, validation, builds, and transcoding, start with the compiler guide.

Serialization with generated models#

Each guide includes a path from XSD generation to serialization. Rust Serde is specific to Rust; other languages use their own runtimes and model metadata.

Target XML with generated models JSON with generated models
Rust Generated quick-xml methods Serde derives and serde_json
Python PolyXML runtime and generated helpers PolyXML runtime and generated helpers
Go encoding/xml, emitted tags/methods encoding/json, emitted tags
C# XmlSerializer, emitted attributes/proxies System.Text.Json
Java Jackson XML or opt-in direct StAX codecs Jackson
C++ Native binding plus explicit model mapping Optional Glaze metadata
TypeScript Native binding with explicit ModelSchema and mapping JSON APIs; optional generated validation

The C++ and TypeScript default generators emit model types without standalone XML codecs. Their runtime bindings require an explicit connection to those models. Round-trip support also depends on the schema features a backend supports; these examples do not establish full XSD conformance.