PolyXML CLI (polyxml)
Unified developer command-line interface and polyglot schema compiler toolchain for PolyXML.
polyxml parses W3C XSD 1.0 and 1.1 schemas into a unified, language-agnostic Intermediate Representation (IR), resolves cyclic/recursive types via Tarjan's Strongly Connected Components (SCC) algorithm, and compiles production-ready, idiomatic data models and codecs for 7 target languages.
Installation
# From workspace root
Supported Target Languages
| Target | Flag (--lang) |
Generated Artifacts & Features |
|---|---|---|
| Python | python |
Modern Python 3.12+ @dataclass or Pydantic v2 models, field constraints, zero-copy streaming codecs |
| Rust | rust |
Zero-copy Cow<'a, str> & owned structs, automatic recursive boxing (Box<T>), streaming serializers/deserializers |
| C++ | cpp |
Modern C++20/C++23 value types, C++20 Modules (--mode modules), Glaze reflection (--backend glaze), CMake/Meson export |
| Java | java |
Java 21+ records, sealed interface choice models, Jackson XML/JSON annotations (--backend jackson) |
| TypeScript | typescript |
TypeScript 5+ interfaces, discriminated unions, Zod runtime validation schemas with z.lazy() recursion |
| Go | go |
Idiomatic Go 1.22+ structs with encoding/xml tags, pointer cycle breaking, choice mutual-exclusivity unmarshaling |
| C# | csharp |
Modern C# 12 / .NET 8+ records with primary constructors, System.Xml.Serialization attributes, IValidatableObject validation |
Commands
1. polyxml generate
Compile schemas directly into code for one or more target languages:
# Generate Python dataclasses
# Generate Pydantic v2 models with runtime validation
# Generate Java 21 records with Enterprise Jackson annotations
# Generate C++20 Modules with Glaze reflectionless serde
# Generate zero-copy Rust models with codecs
# Multi-target compilation in a single invocation
# Dry-run inspection without writing files to disk
2. polyxml build
Build an entire multi-target, multi-schema project declaratively from a polyxml.toml workspace manifest:
3. polyxml validate
Statically check W3C XML schemas for structural validity, element types, and cycle topology:
Workspace Manifest (polyxml.toml)
[]
= "enterprise-data-pipeline"
= ["schemas/iso20022/*.xsd"]
= ["schemas/common/"]
= "./generated"
[[]]
= "python"
= "src/generated/python"
= "pydantic-v2"
= true
[[]]
= "rust"
= "src/generated/rust"
= true
= true
[[]]
= "java"
= "src/generated/java"
= "com.enterprise.banking.iso20022"
= "jackson"
[[]]
= "typescript"
= "src/generated/ts"
[[]]
= "cpp"
= "src/generated/cpp"
= "modules"
= "glaze"
[[]]
= "go"
= "src/generated/go"
= "payments"
[[]]
= "csharp"
= "src/generated/csharp"
= "Enterprise.Banking.Iso20022"