Command Line#

Make sure the cli requirements are installed.

$ pip install xsdata[cli]
xsdata --help
Install cli requirements "pip install xsdata[cli]"

Generate Code#

xsdata generate --help
Install cli requirements "pip install xsdata[cli]"
Scan directory for xsd, wsdl, xml files#
$ xsdata amadeus/schemas --package amadeus.models
Convert a local schema#
$ xsdata air_v48_0/AirReqRsp.xsd --package travelport.models
Convert a remote schema#
$ xsdata --package feeds --print
Convert a remote xml file#
$ xsdata --print

Output plugins#

Circular imports#

Python is vulnerable to xsd circular imports. xsData by default groups all classes by the schema location they are defined. This works well for schemas that avoid circular imports. If you get import errors you should try one of the alternative structure styles.


This style will identify the strongly connected classes and will group them together, creating as many modules as possible. The modules are named after the the main class of the group.

$ xsdata schema.xsd --package models --structure-style clusters


This style will group classes by the target namespace they were originally defined. It works well when the types of a namespace are spread across multiple schemas eg. type substitutions, redefines.

$ xsdata schema.xsd --package models --structure-style namespaces

Since v21.8, the generator converts namespaces to packages similar to jaxb in order to facilitate runs against multiple schemas from the same vendor.

Examples (before naming conventions)






This style combines the clusters and the namespace styles. It will fail if there are strongly connected classes in the same graph from different namespaces.

$ xsdata schema.xsd --package models --structure-style namespace-clusters


This style will group all classes together into a single package eliminating imports altogether.

$ xsdata schema.xsd --package models --structure-style single-package

Initialize Config#

Initialize a project configuration with more advanced features, see more.

xsdata init-config --help
Install cli requirements "pip install xsdata[cli]"
$ xsdata amadeus/schemas --config amadeus/.xsdata.xml

Download Schemas#

xsdata download --help
Install cli requirements "pip install xsdata[cli]"


Check the Examples and the samples repo for more ✨✨✨