Command-line reference¶
pyxsd [options]
pyxsd is the console script installed by the package (equivalent to
python -m pyxsd).
Flags¶
Flag |
Long form(s) |
Meaning |
|---|---|---|
|
Print the version and exit. |
|
|
|
Filename of the XML document to read in. Reads from stdin by default. |
|
|
Filename of the XSD schema. By default pyxsd tries to determine the location from the instance document (schema hints). |
|
|
Filename for the parsed (pre-transform) output. Default: input filename + |
|
|
Write the parsed tree even when transforms are given. Off by default. |
|
|
Output after parsing and transforming. stdout by default. |
|
|
Use the default filename for transformed output instead of stdout. |
|
|
Transform call(s): |
|
|
File with transform calls, one per line. Mutually exclusive with |
|
|
Experimental. Overlay class file that extends/overrides generated classes. |
|
|
Verbose logging (DEBUG). |
|
|
Quiet logging (CRITICAL). Validation issues are still printed. |
|
Exit with status 1 if the validation report contains errors. |
Exit codes¶
0— run completed (validation issues are non-fatal).1—--strictand the report contains errors, or a fatal error occurred (missing schema, unreadable input, malformed schema).2— command-line usage error (argparse).
Schema location¶
When -s is omitted, pyxsd reads the instance document first and looks for
schema hints — a xsi:noNamespaceSchemaLocation attribute or a
xsi:schemaLocation pair — and resolves the schema path relative to the
instance file. A malformed hint produces a warning (schema-hint code); no
hint at all produces an error unless -s is given.
Examples¶
# Round-trip: parse and write the parsed tree back out
pyxsd -i inventory.xml -k -o parsed.xml
# Validate against an explicit schema, strict mode (CI-friendly)
pyxsd -i inventory.xml -s inventory.xsd --strict
# Transform pipeline: both transforms run, final tree to stdout
pyxsd -i inventory.xml -t 'PrintData() > PrintData()'
# Transform calls from a file
pyxsd -i inventory.xml -T transforms.txt