Skip to main content

XML Generator

PyPI - Version PyPI - Downloads Coverage Ask DeepWiki

[ 🇷🇺 Русский ]

Generates XML documents based on XSD schemas with the ability to customize data through a YAML configuration file.

Simplifies the creation of test or demonstration XML data for complex schemas.

Features

  • Generation of XML documents based on XSD schemas
  • Customization of generated values via a YAML configuration file
  • Validation of generated documents
  • Command-line interface for convenient use

Installation

Installation via pip

pip install xmlgenerator

Install executable file manually (linux)

curl -LO https://github.com/lexakimov/xmlgenerator/releases/latest/download/xmlgenerator-linux-amd64
chmod +x xmlgenerator-linux-amd64
sudo install xmlgenerator-linux-amd64 /usr/local/bin/xmlgenerator

# also, you can install shell completions
# available: bash, zsh, tcsh
xmlgenerator -C bash | sudo tee /etc/bash_completion.d/xmlgenerator

Usage

The generator command is xmlgenerator

Flags and parameters:

usage: xmlgenerator [-h] [-c <config.yml>] [-o <output.xml>] [-p] [-n alias=namespace] [-v <validation>] [-i]
                    [-e <encoding>] [-s <seed>] [-d] [-V] [-C <shell>]
                    xsd [xsd ...]

Generates XML documents from XSD schemas

positional arguments:
  xsd                              paths to xsd schema(s) or directory with xsd schemas

options:
  -h, --help                       show this help message and exit
  -c, --config <config.yml>        pass a YAML configuration file
  -o, --output <output.xml>        save the output to a directory or file
  -p, --pretty                     prettify the output XML
  -n, --namespace alias=namespace  define XML namespace alias (repeatable flag)
  -v, --validation <validation>    validate the generated XML document (none, schema, schematron; default: schema)
  -i, --ignore-errors              continue execution when validation errors occur
  -e, --encoding <encoding>        the output XML encoding (utf-8, windows-1251; default: utf-8)
  -s, --seed <seed>                set the randomization seed
  -d, --debug                      enable debug mode
  -V, --version                    show the current version
  -C, --completion <shell>         print a shell completion script (bash, zsh, tcsh)

Examples:

  • Generate XML from a single schema and print to console:

    xmlgenerator path/to/your/schema.xsd
    
  • Generate XML from all schemas in a directory and save to the output folder using a configuration file:

    xmlgenerator -c config.yml -o output/ path/to/schemas/
    
  • Generate XML from a specific schema, save to a file with pretty formatting and windows-1251 encoding:

    xmlgenerator -o output.xml -p -e windows-1251 path/to/your/schema.xsd
    
  • Generate XML with validation disabled:

    xmlgenerator -v none path/to/your/schema.xsd
    

Configuration

The generator can be configured using a YAML file passed via the -c or --config option.

Description and examples of configuration are in CONFIGURATION.

Validation

Generated XML documents are checked for conformance against the schema used for generation. By default, validation against the source XSD schema is used.

If a document does not conform to the schema, execution stops immediately. To keep processing despite validation errors, pass the -i flag.

To disable validation, use the flag -v none or --validation none.

Contribution

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Build from source

  1. Clone the repository:

    git clone https://github.com/lexakimov/xmlgenerator.git
    cd xmlgenerator
    
  2. Create and activate a virtual environment (recommended):

    python -m venv .venv
    
    • For Linux/macOS:
      source .venv/bin/activate
      
    • For Windows (Command Prompt/PowerShell):
      .\.venv\Scripts\activate
      
  3. Install the project with development dependencies:

    pip install -e ".[dev]"
    

4.1. Install the package:

Install in develop mode (code changes will be immediately reflected):

pip install -e .

4.2. Otherwise, build single executable:

python build_native.py

Running Tests

pip install -e ".[test]"
pytest

Run tests with coverage:

pytest --cov=xmlgenerator --cov-report=term-missing --cov-report=html

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contacts

For any questions or issues, please contact [lex.akimov23@gmail.com].

You can also create an Issue on GitHub to report bugs or suggest improvements.

Metadata

Release files for xmlgenerator 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xmlgenerator 0.10.0
File Size Uploaded Provenance
xmlgenerator-0.10.0.tar.gz 23.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for xmlgenerator 0.10.0
File Interpreter ABI Platform
xmlgenerator-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 46.4 kB

Release files / xmlgenerator-0.10.0.tar.gz

Download URL xmlgenerator-0.10.0.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ee79288eb6828a896547134bf76e162ec276b7ec470508af52805839f7d2d7bc
BLAKE2b-256 checksum
How to use checksums
f6edb037564179cef4d2cccd5ef3a70a8b74401e11af6d531cc2fbb4ccf838ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / xmlgenerator-0.10.0-py3-none-any.whl

Download URL xmlgenerator-0.10.0-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b4c67fb08418f59d93d4ca9ebd86a06b18d1dccbf7443e8b41ace9d188344bd
BLAKE2b-256 checksum
How to use checksums
a1f6a21b13dd613645118ead915585696c02beda8b8d567fbbaa876aae46069a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for xmlgenerator 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page