xmlgenerator 0.5.2__tar.gz → 0.5.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xmlgenerator-0.5.3/PKG-INFO +205 -0
- xmlgenerator-0.5.3/README.md +175 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/setup.py +1 -1
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator/arguments.py +10 -10
- xmlgenerator-0.5.3/xmlgenerator.egg-info/PKG-INFO +205 -0
- xmlgenerator-0.5.2/PKG-INFO +0 -320
- xmlgenerator-0.5.2/README.md +0 -290
- xmlgenerator-0.5.2/xmlgenerator.egg-info/PKG-INFO +0 -320
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/LICENSE +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/setup.cfg +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator/__init__.py +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator/bootstrap.py +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator/configuration.py +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator/generator.py +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator/randomization.py +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator/substitution.py +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator/validation.py +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator.egg-info/SOURCES.txt +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator.egg-info/dependency_links.txt +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator.egg-info/entry_points.txt +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator.egg-info/requires.txt +0 -0
- {xmlgenerator-0.5.2 → xmlgenerator-0.5.3}/xmlgenerator.egg-info/top_level.txt +0 -0
@@ -0,0 +1,205 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: xmlgenerator
|
3
|
+
Version: 0.5.3
|
4
|
+
Summary: Generates XML documents from XSD schemas
|
5
|
+
Home-page: https://github.com/lexakimov/xmlgenerator
|
6
|
+
Author: Alexey Akimov
|
7
|
+
Author-email: lex.akimov23@gmail.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.6
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
License-File: LICENSE
|
14
|
+
Requires-Dist: lxml
|
15
|
+
Requires-Dist: xmlschema
|
16
|
+
Requires-Dist: Faker
|
17
|
+
Requires-Dist: rstr
|
18
|
+
Requires-Dist: PyYAML
|
19
|
+
Requires-Dist: shtab
|
20
|
+
Dynamic: author
|
21
|
+
Dynamic: author-email
|
22
|
+
Dynamic: classifier
|
23
|
+
Dynamic: description
|
24
|
+
Dynamic: description-content-type
|
25
|
+
Dynamic: home-page
|
26
|
+
Dynamic: license-file
|
27
|
+
Dynamic: requires-dist
|
28
|
+
Dynamic: requires-python
|
29
|
+
Dynamic: summary
|
30
|
+
|
31
|
+
# XML Generator
|
32
|
+
|
33
|
+
- [Русский 🇷🇺](README_RU.md)
|
34
|
+
- [English 🇺🇸](README.md)
|
35
|
+
|
36
|
+
Generates XML documents based on XSD schemas with the ability to customize data through a YAML configuration file.
|
37
|
+
|
38
|
+
Simplifies the creation of test or demonstration XML data for complex schemas.
|
39
|
+
|
40
|
+
## Features
|
41
|
+
|
42
|
+
- Generation of XML documents based on XSD schemas
|
43
|
+
- Customization of generated values via a YAML configuration file
|
44
|
+
- Validation of generated documents
|
45
|
+
- Command-line interface for convenient use
|
46
|
+
|
47
|
+
## Installation
|
48
|
+
|
49
|
+
### Installation via pip
|
50
|
+
|
51
|
+
```bash
|
52
|
+
pip install xmlgenerator
|
53
|
+
```
|
54
|
+
|
55
|
+
### Install executable file manually (linux)
|
56
|
+
|
57
|
+
```bash
|
58
|
+
curl -LO https://github.com/lexakimov/xmlgenerator/releases/download/v0.5.3/xmlgenerator-linux-amd64
|
59
|
+
chmod +x xmlgenerator-linux-amd64
|
60
|
+
sudo install xmlgenerator-linux-amd64 /usr/local/bin/xmlgenerator
|
61
|
+
```
|
62
|
+
|
63
|
+
### Install shell completions (linux)
|
64
|
+
|
65
|
+
```shell
|
66
|
+
# also available: zsh, tcsh
|
67
|
+
xmlgenerator -C bash | sudo tee /etc/bash_completion.d/xmlgenerator
|
68
|
+
```
|
69
|
+
|
70
|
+
## Usage
|
71
|
+
|
72
|
+
The generator command is `xmlgenerator`
|
73
|
+
|
74
|
+
**Flags and parameters:**
|
75
|
+
|
76
|
+
```
|
77
|
+
usage: xmlgenerator [-h] [-c <config.yml>] [-l <locale>] [-o <output.xml>] [-p] [-v <validation>] [-ff] [-e <encoding>]
|
78
|
+
[-s <seed>] [-d] [-V] [-C <shell>]
|
79
|
+
xsd [xsd ...]
|
80
|
+
|
81
|
+
Generates XML documents from XSD schemas
|
82
|
+
|
83
|
+
positional arguments:
|
84
|
+
xsd paths to xsd schema(s) or directory with xsd schemas
|
85
|
+
|
86
|
+
options:
|
87
|
+
-h, --help show this help message and exit
|
88
|
+
-c, --config <config.yml> pass a YAML configuration file
|
89
|
+
-l, --locale <locale> locale for the randomizer (default: en_US)
|
90
|
+
-o, --output <output.xml> save the output to a directory or file
|
91
|
+
-p, --pretty prettify the output XML
|
92
|
+
-v, --validation <validation> validate the generated XML document (none, schema, schematron; default: schema)
|
93
|
+
-ff, --fail-fast terminate execution on a validation error (default: true)
|
94
|
+
-e, --encoding <encoding> the output XML encoding (utf-8, windows-1251; default: utf-8)
|
95
|
+
-s, --seed <seed> set the randomization seed
|
96
|
+
-d, --debug enable debug mode
|
97
|
+
-V, --version show the current version
|
98
|
+
-C, --completion <shell> print a shell completion script (bash, zsh, tcsh)
|
99
|
+
```
|
100
|
+
|
101
|
+
**Examples:**
|
102
|
+
|
103
|
+
- Generate XML from a single schema and print to console:
|
104
|
+
```bash
|
105
|
+
xmlgenerator path/to/your/schema.xsd
|
106
|
+
```
|
107
|
+
|
108
|
+
- Generate XML from all schemas in a directory and save to the `output` folder using a configuration file:
|
109
|
+
```bash
|
110
|
+
xmlgenerator -c config.yml -o output/ path/to/schemas/
|
111
|
+
```
|
112
|
+
|
113
|
+
- Generate XML from a specific schema, save to a file with pretty formatting and windows-1251 encoding:
|
114
|
+
```bash
|
115
|
+
xmlgenerator -o output.xml -p -e windows-1251 path/to/your/schema.xsd
|
116
|
+
```
|
117
|
+
|
118
|
+
- Generate XML with validation disabled:
|
119
|
+
```bash
|
120
|
+
xmlgenerator -v none path/to/your/schema.xsd
|
121
|
+
```
|
122
|
+
|
123
|
+
## Configuration
|
124
|
+
|
125
|
+
The generator can be configured using a YAML file passed via the `-c` or `--config` option.
|
126
|
+
|
127
|
+
Description and examples of configuration are in [CONFIGURATION](./CONFIGURATION.md).
|
128
|
+
|
129
|
+
## Validation
|
130
|
+
|
131
|
+
Generated XML documents are checked for conformance against the schema used for generation.
|
132
|
+
By default, validation against the source XSD schema is used.
|
133
|
+
|
134
|
+
If a document does not conform to the schema, execution stops immediately.
|
135
|
+
This behavior can be disabled using the flag `-ff false` or `--fail-fast false`.
|
136
|
+
|
137
|
+
To disable validation, use the flag `-v none` or `--validation none`.
|
138
|
+
|
139
|
+
## Contribution
|
140
|
+
|
141
|
+
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
|
142
|
+
|
143
|
+
### Build from source
|
144
|
+
|
145
|
+
1. **Clone the repository:**
|
146
|
+
```bash
|
147
|
+
git clone https://github.com/lexakimov/xmlgenerator.git
|
148
|
+
cd xmlgenerator
|
149
|
+
```
|
150
|
+
|
151
|
+
2. **Create and activate a virtual environment (recommended):**
|
152
|
+
```bash
|
153
|
+
python -m venv .venv
|
154
|
+
```
|
155
|
+
* **For Linux/macOS:**
|
156
|
+
```bash
|
157
|
+
source .venv/bin/activate
|
158
|
+
```
|
159
|
+
* **For Windows (Command Prompt/PowerShell):**
|
160
|
+
```bash
|
161
|
+
.\.venv\Scripts\activate
|
162
|
+
```
|
163
|
+
|
164
|
+
3. **Install dependencies:**
|
165
|
+
```bash
|
166
|
+
pip install -r requirements.txt
|
167
|
+
```
|
168
|
+
|
169
|
+
4.1. **Install the package:**
|
170
|
+
|
171
|
+
```bash
|
172
|
+
pip install .
|
173
|
+
# or for development mode (code changes will be immediately reflected)
|
174
|
+
# pip install -e .
|
175
|
+
```
|
176
|
+
|
177
|
+
4.2. **Otherwise, build single executable:**
|
178
|
+
|
179
|
+
```bash
|
180
|
+
python build_native.py
|
181
|
+
```
|
182
|
+
|
183
|
+
### Project Structure
|
184
|
+
|
185
|
+
- `xmlgenerator/` - main project code
|
186
|
+
- `tests/` - tests
|
187
|
+
|
188
|
+
### Running Tests
|
189
|
+
|
190
|
+
```bash
|
191
|
+
pytest
|
192
|
+
```
|
193
|
+
|
194
|
+
---
|
195
|
+
|
196
|
+
## License
|
197
|
+
|
198
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
199
|
+
|
200
|
+
## Contacts
|
201
|
+
|
202
|
+
For any questions or issues, please contact [lex.akimov23@gmail.com].
|
203
|
+
|
204
|
+
You can also create an [Issue on GitHub](https://github.com/lexakimov/xmlgenerator/issues) to report bugs or suggest
|
205
|
+
improvements.
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# XML Generator
|
2
|
+
|
3
|
+
- [Русский 🇷🇺](README_RU.md)
|
4
|
+
- [English 🇺🇸](README.md)
|
5
|
+
|
6
|
+
Generates XML documents based on XSD schemas with the ability to customize data through a YAML configuration file.
|
7
|
+
|
8
|
+
Simplifies the creation of test or demonstration XML data for complex schemas.
|
9
|
+
|
10
|
+
## Features
|
11
|
+
|
12
|
+
- Generation of XML documents based on XSD schemas
|
13
|
+
- Customization of generated values via a YAML configuration file
|
14
|
+
- Validation of generated documents
|
15
|
+
- Command-line interface for convenient use
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
### Installation via pip
|
20
|
+
|
21
|
+
```bash
|
22
|
+
pip install xmlgenerator
|
23
|
+
```
|
24
|
+
|
25
|
+
### Install executable file manually (linux)
|
26
|
+
|
27
|
+
```bash
|
28
|
+
curl -LO https://github.com/lexakimov/xmlgenerator/releases/download/v0.5.3/xmlgenerator-linux-amd64
|
29
|
+
chmod +x xmlgenerator-linux-amd64
|
30
|
+
sudo install xmlgenerator-linux-amd64 /usr/local/bin/xmlgenerator
|
31
|
+
```
|
32
|
+
|
33
|
+
### Install shell completions (linux)
|
34
|
+
|
35
|
+
```shell
|
36
|
+
# also available: zsh, tcsh
|
37
|
+
xmlgenerator -C bash | sudo tee /etc/bash_completion.d/xmlgenerator
|
38
|
+
```
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
|
42
|
+
The generator command is `xmlgenerator`
|
43
|
+
|
44
|
+
**Flags and parameters:**
|
45
|
+
|
46
|
+
```
|
47
|
+
usage: xmlgenerator [-h] [-c <config.yml>] [-l <locale>] [-o <output.xml>] [-p] [-v <validation>] [-ff] [-e <encoding>]
|
48
|
+
[-s <seed>] [-d] [-V] [-C <shell>]
|
49
|
+
xsd [xsd ...]
|
50
|
+
|
51
|
+
Generates XML documents from XSD schemas
|
52
|
+
|
53
|
+
positional arguments:
|
54
|
+
xsd paths to xsd schema(s) or directory with xsd schemas
|
55
|
+
|
56
|
+
options:
|
57
|
+
-h, --help show this help message and exit
|
58
|
+
-c, --config <config.yml> pass a YAML configuration file
|
59
|
+
-l, --locale <locale> locale for the randomizer (default: en_US)
|
60
|
+
-o, --output <output.xml> save the output to a directory or file
|
61
|
+
-p, --pretty prettify the output XML
|
62
|
+
-v, --validation <validation> validate the generated XML document (none, schema, schematron; default: schema)
|
63
|
+
-ff, --fail-fast terminate execution on a validation error (default: true)
|
64
|
+
-e, --encoding <encoding> the output XML encoding (utf-8, windows-1251; default: utf-8)
|
65
|
+
-s, --seed <seed> set the randomization seed
|
66
|
+
-d, --debug enable debug mode
|
67
|
+
-V, --version show the current version
|
68
|
+
-C, --completion <shell> print a shell completion script (bash, zsh, tcsh)
|
69
|
+
```
|
70
|
+
|
71
|
+
**Examples:**
|
72
|
+
|
73
|
+
- Generate XML from a single schema and print to console:
|
74
|
+
```bash
|
75
|
+
xmlgenerator path/to/your/schema.xsd
|
76
|
+
```
|
77
|
+
|
78
|
+
- Generate XML from all schemas in a directory and save to the `output` folder using a configuration file:
|
79
|
+
```bash
|
80
|
+
xmlgenerator -c config.yml -o output/ path/to/schemas/
|
81
|
+
```
|
82
|
+
|
83
|
+
- Generate XML from a specific schema, save to a file with pretty formatting and windows-1251 encoding:
|
84
|
+
```bash
|
85
|
+
xmlgenerator -o output.xml -p -e windows-1251 path/to/your/schema.xsd
|
86
|
+
```
|
87
|
+
|
88
|
+
- Generate XML with validation disabled:
|
89
|
+
```bash
|
90
|
+
xmlgenerator -v none path/to/your/schema.xsd
|
91
|
+
```
|
92
|
+
|
93
|
+
## Configuration
|
94
|
+
|
95
|
+
The generator can be configured using a YAML file passed via the `-c` or `--config` option.
|
96
|
+
|
97
|
+
Description and examples of configuration are in [CONFIGURATION](./CONFIGURATION.md).
|
98
|
+
|
99
|
+
## Validation
|
100
|
+
|
101
|
+
Generated XML documents are checked for conformance against the schema used for generation.
|
102
|
+
By default, validation against the source XSD schema is used.
|
103
|
+
|
104
|
+
If a document does not conform to the schema, execution stops immediately.
|
105
|
+
This behavior can be disabled using the flag `-ff false` or `--fail-fast false`.
|
106
|
+
|
107
|
+
To disable validation, use the flag `-v none` or `--validation none`.
|
108
|
+
|
109
|
+
## Contribution
|
110
|
+
|
111
|
+
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
|
112
|
+
|
113
|
+
### Build from source
|
114
|
+
|
115
|
+
1. **Clone the repository:**
|
116
|
+
```bash
|
117
|
+
git clone https://github.com/lexakimov/xmlgenerator.git
|
118
|
+
cd xmlgenerator
|
119
|
+
```
|
120
|
+
|
121
|
+
2. **Create and activate a virtual environment (recommended):**
|
122
|
+
```bash
|
123
|
+
python -m venv .venv
|
124
|
+
```
|
125
|
+
* **For Linux/macOS:**
|
126
|
+
```bash
|
127
|
+
source .venv/bin/activate
|
128
|
+
```
|
129
|
+
* **For Windows (Command Prompt/PowerShell):**
|
130
|
+
```bash
|
131
|
+
.\.venv\Scripts\activate
|
132
|
+
```
|
133
|
+
|
134
|
+
3. **Install dependencies:**
|
135
|
+
```bash
|
136
|
+
pip install -r requirements.txt
|
137
|
+
```
|
138
|
+
|
139
|
+
4.1. **Install the package:**
|
140
|
+
|
141
|
+
```bash
|
142
|
+
pip install .
|
143
|
+
# or for development mode (code changes will be immediately reflected)
|
144
|
+
# pip install -e .
|
145
|
+
```
|
146
|
+
|
147
|
+
4.2. **Otherwise, build single executable:**
|
148
|
+
|
149
|
+
```bash
|
150
|
+
python build_native.py
|
151
|
+
```
|
152
|
+
|
153
|
+
### Project Structure
|
154
|
+
|
155
|
+
- `xmlgenerator/` - main project code
|
156
|
+
- `tests/` - tests
|
157
|
+
|
158
|
+
### Running Tests
|
159
|
+
|
160
|
+
```bash
|
161
|
+
pytest
|
162
|
+
```
|
163
|
+
|
164
|
+
---
|
165
|
+
|
166
|
+
## License
|
167
|
+
|
168
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
169
|
+
|
170
|
+
## Contacts
|
171
|
+
|
172
|
+
For any questions or issues, please contact [lex.akimov23@gmail.com].
|
173
|
+
|
174
|
+
You can also create an [Issue on GitHub](https://github.com/lexakimov/xmlgenerator/issues) to report bugs or suggest
|
175
|
+
improvements.
|
@@ -37,49 +37,49 @@ def _get_parser():
|
|
37
37
|
"-c", "--config",
|
38
38
|
metavar="<config.yml>",
|
39
39
|
dest="config_yaml",
|
40
|
-
help="pass
|
40
|
+
help="pass a YAML configuration file"
|
41
41
|
)
|
42
42
|
parser.add_argument(
|
43
43
|
"-l", "--locale",
|
44
44
|
metavar="<locale>",
|
45
45
|
default="en_US",
|
46
|
-
help="randomizer
|
46
|
+
help="locale for the randomizer (default: %(default)s)"
|
47
47
|
)
|
48
48
|
output_arg = parser.add_argument(
|
49
49
|
"-o", "--output",
|
50
50
|
metavar="<output.xml>",
|
51
51
|
dest="output_path",
|
52
|
-
help="save output to
|
52
|
+
help="save the output to a directory or file"
|
53
53
|
)
|
54
54
|
parser.add_argument(
|
55
55
|
"-p", "--pretty",
|
56
56
|
action="store_true",
|
57
|
-
help="prettify output XML"
|
57
|
+
help="prettify the output XML"
|
58
58
|
)
|
59
59
|
parser.add_argument(
|
60
60
|
"-v", "--validation",
|
61
61
|
metavar="<validation>",
|
62
62
|
choices=["none", "schema", "schematron"],
|
63
63
|
default="schema",
|
64
|
-
help="validate generated XML document (none, schema, schematron
|
64
|
+
help="validate the generated XML document (none, schema, schematron; default: %(default)s)"
|
65
65
|
)
|
66
66
|
parser.add_argument(
|
67
67
|
"-ff", "--fail-fast",
|
68
68
|
action="store_true",
|
69
69
|
default="true",
|
70
|
-
help="terminate execution on validation error (default
|
70
|
+
help="terminate execution on a validation error (default: %(default)s)"
|
71
71
|
)
|
72
72
|
parser.add_argument(
|
73
73
|
"-e", "--encoding",
|
74
74
|
metavar="<encoding>",
|
75
75
|
choices=["utf-8", "windows-1251"],
|
76
76
|
default="utf-8",
|
77
|
-
help="output XML encoding (utf-8, windows-1251
|
77
|
+
help="the output XML encoding (utf-8, windows-1251; default: %(default)s)"
|
78
78
|
)
|
79
79
|
parser.add_argument(
|
80
80
|
"-s", "--seed",
|
81
81
|
metavar="<seed>",
|
82
|
-
help="set randomization seed"
|
82
|
+
help="set the randomization seed"
|
83
83
|
)
|
84
84
|
parser.add_argument(
|
85
85
|
"-d", "--debug",
|
@@ -90,14 +90,14 @@ def _get_parser():
|
|
90
90
|
"-V", "--version",
|
91
91
|
action='version',
|
92
92
|
version='%(prog)s 0.1.0',
|
93
|
-
help="
|
93
|
+
help="show the current version"
|
94
94
|
)
|
95
95
|
|
96
96
|
# add shell completions
|
97
97
|
config_arg.complete = shtab.FILE
|
98
98
|
source_arg.complete = shtab.FILE
|
99
99
|
output_arg.complete = shtab.FILE
|
100
|
-
shtab.add_argument_to(parser, ["-C", "--completion"], "print shell completion script (bash, zsh, tcsh)")
|
100
|
+
shtab.add_argument_to(parser, ["-C", "--completion"], "print a shell completion script (bash, zsh, tcsh)")
|
101
101
|
completion_act = [a for a in parser._actions if a.dest == 'completion']
|
102
102
|
if completion_act:
|
103
103
|
completion_act[0].metavar = '<shell>'
|
@@ -0,0 +1,205 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: xmlgenerator
|
3
|
+
Version: 0.5.3
|
4
|
+
Summary: Generates XML documents from XSD schemas
|
5
|
+
Home-page: https://github.com/lexakimov/xmlgenerator
|
6
|
+
Author: Alexey Akimov
|
7
|
+
Author-email: lex.akimov23@gmail.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.6
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
License-File: LICENSE
|
14
|
+
Requires-Dist: lxml
|
15
|
+
Requires-Dist: xmlschema
|
16
|
+
Requires-Dist: Faker
|
17
|
+
Requires-Dist: rstr
|
18
|
+
Requires-Dist: PyYAML
|
19
|
+
Requires-Dist: shtab
|
20
|
+
Dynamic: author
|
21
|
+
Dynamic: author-email
|
22
|
+
Dynamic: classifier
|
23
|
+
Dynamic: description
|
24
|
+
Dynamic: description-content-type
|
25
|
+
Dynamic: home-page
|
26
|
+
Dynamic: license-file
|
27
|
+
Dynamic: requires-dist
|
28
|
+
Dynamic: requires-python
|
29
|
+
Dynamic: summary
|
30
|
+
|
31
|
+
# XML Generator
|
32
|
+
|
33
|
+
- [Русский 🇷🇺](README_RU.md)
|
34
|
+
- [English 🇺🇸](README.md)
|
35
|
+
|
36
|
+
Generates XML documents based on XSD schemas with the ability to customize data through a YAML configuration file.
|
37
|
+
|
38
|
+
Simplifies the creation of test or demonstration XML data for complex schemas.
|
39
|
+
|
40
|
+
## Features
|
41
|
+
|
42
|
+
- Generation of XML documents based on XSD schemas
|
43
|
+
- Customization of generated values via a YAML configuration file
|
44
|
+
- Validation of generated documents
|
45
|
+
- Command-line interface for convenient use
|
46
|
+
|
47
|
+
## Installation
|
48
|
+
|
49
|
+
### Installation via pip
|
50
|
+
|
51
|
+
```bash
|
52
|
+
pip install xmlgenerator
|
53
|
+
```
|
54
|
+
|
55
|
+
### Install executable file manually (linux)
|
56
|
+
|
57
|
+
```bash
|
58
|
+
curl -LO https://github.com/lexakimov/xmlgenerator/releases/download/v0.5.3/xmlgenerator-linux-amd64
|
59
|
+
chmod +x xmlgenerator-linux-amd64
|
60
|
+
sudo install xmlgenerator-linux-amd64 /usr/local/bin/xmlgenerator
|
61
|
+
```
|
62
|
+
|
63
|
+
### Install shell completions (linux)
|
64
|
+
|
65
|
+
```shell
|
66
|
+
# also available: zsh, tcsh
|
67
|
+
xmlgenerator -C bash | sudo tee /etc/bash_completion.d/xmlgenerator
|
68
|
+
```
|
69
|
+
|
70
|
+
## Usage
|
71
|
+
|
72
|
+
The generator command is `xmlgenerator`
|
73
|
+
|
74
|
+
**Flags and parameters:**
|
75
|
+
|
76
|
+
```
|
77
|
+
usage: xmlgenerator [-h] [-c <config.yml>] [-l <locale>] [-o <output.xml>] [-p] [-v <validation>] [-ff] [-e <encoding>]
|
78
|
+
[-s <seed>] [-d] [-V] [-C <shell>]
|
79
|
+
xsd [xsd ...]
|
80
|
+
|
81
|
+
Generates XML documents from XSD schemas
|
82
|
+
|
83
|
+
positional arguments:
|
84
|
+
xsd paths to xsd schema(s) or directory with xsd schemas
|
85
|
+
|
86
|
+
options:
|
87
|
+
-h, --help show this help message and exit
|
88
|
+
-c, --config <config.yml> pass a YAML configuration file
|
89
|
+
-l, --locale <locale> locale for the randomizer (default: en_US)
|
90
|
+
-o, --output <output.xml> save the output to a directory or file
|
91
|
+
-p, --pretty prettify the output XML
|
92
|
+
-v, --validation <validation> validate the generated XML document (none, schema, schematron; default: schema)
|
93
|
+
-ff, --fail-fast terminate execution on a validation error (default: true)
|
94
|
+
-e, --encoding <encoding> the output XML encoding (utf-8, windows-1251; default: utf-8)
|
95
|
+
-s, --seed <seed> set the randomization seed
|
96
|
+
-d, --debug enable debug mode
|
97
|
+
-V, --version show the current version
|
98
|
+
-C, --completion <shell> print a shell completion script (bash, zsh, tcsh)
|
99
|
+
```
|
100
|
+
|
101
|
+
**Examples:**
|
102
|
+
|
103
|
+
- Generate XML from a single schema and print to console:
|
104
|
+
```bash
|
105
|
+
xmlgenerator path/to/your/schema.xsd
|
106
|
+
```
|
107
|
+
|
108
|
+
- Generate XML from all schemas in a directory and save to the `output` folder using a configuration file:
|
109
|
+
```bash
|
110
|
+
xmlgenerator -c config.yml -o output/ path/to/schemas/
|
111
|
+
```
|
112
|
+
|
113
|
+
- Generate XML from a specific schema, save to a file with pretty formatting and windows-1251 encoding:
|
114
|
+
```bash
|
115
|
+
xmlgenerator -o output.xml -p -e windows-1251 path/to/your/schema.xsd
|
116
|
+
```
|
117
|
+
|
118
|
+
- Generate XML with validation disabled:
|
119
|
+
```bash
|
120
|
+
xmlgenerator -v none path/to/your/schema.xsd
|
121
|
+
```
|
122
|
+
|
123
|
+
## Configuration
|
124
|
+
|
125
|
+
The generator can be configured using a YAML file passed via the `-c` or `--config` option.
|
126
|
+
|
127
|
+
Description and examples of configuration are in [CONFIGURATION](./CONFIGURATION.md).
|
128
|
+
|
129
|
+
## Validation
|
130
|
+
|
131
|
+
Generated XML documents are checked for conformance against the schema used for generation.
|
132
|
+
By default, validation against the source XSD schema is used.
|
133
|
+
|
134
|
+
If a document does not conform to the schema, execution stops immediately.
|
135
|
+
This behavior can be disabled using the flag `-ff false` or `--fail-fast false`.
|
136
|
+
|
137
|
+
To disable validation, use the flag `-v none` or `--validation none`.
|
138
|
+
|
139
|
+
## Contribution
|
140
|
+
|
141
|
+
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
|
142
|
+
|
143
|
+
### Build from source
|
144
|
+
|
145
|
+
1. **Clone the repository:**
|
146
|
+
```bash
|
147
|
+
git clone https://github.com/lexakimov/xmlgenerator.git
|
148
|
+
cd xmlgenerator
|
149
|
+
```
|
150
|
+
|
151
|
+
2. **Create and activate a virtual environment (recommended):**
|
152
|
+
```bash
|
153
|
+
python -m venv .venv
|
154
|
+
```
|
155
|
+
* **For Linux/macOS:**
|
156
|
+
```bash
|
157
|
+
source .venv/bin/activate
|
158
|
+
```
|
159
|
+
* **For Windows (Command Prompt/PowerShell):**
|
160
|
+
```bash
|
161
|
+
.\.venv\Scripts\activate
|
162
|
+
```
|
163
|
+
|
164
|
+
3. **Install dependencies:**
|
165
|
+
```bash
|
166
|
+
pip install -r requirements.txt
|
167
|
+
```
|
168
|
+
|
169
|
+
4.1. **Install the package:**
|
170
|
+
|
171
|
+
```bash
|
172
|
+
pip install .
|
173
|
+
# or for development mode (code changes will be immediately reflected)
|
174
|
+
# pip install -e .
|
175
|
+
```
|
176
|
+
|
177
|
+
4.2. **Otherwise, build single executable:**
|
178
|
+
|
179
|
+
```bash
|
180
|
+
python build_native.py
|
181
|
+
```
|
182
|
+
|
183
|
+
### Project Structure
|
184
|
+
|
185
|
+
- `xmlgenerator/` - main project code
|
186
|
+
- `tests/` - tests
|
187
|
+
|
188
|
+
### Running Tests
|
189
|
+
|
190
|
+
```bash
|
191
|
+
pytest
|
192
|
+
```
|
193
|
+
|
194
|
+
---
|
195
|
+
|
196
|
+
## License
|
197
|
+
|
198
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
199
|
+
|
200
|
+
## Contacts
|
201
|
+
|
202
|
+
For any questions or issues, please contact [lex.akimov23@gmail.com].
|
203
|
+
|
204
|
+
You can also create an [Issue on GitHub](https://github.com/lexakimov/xmlgenerator/issues) to report bugs or suggest
|
205
|
+
improvements.
|