Converts YAML files to XML using Python 3
MIT License
Script converter of YAML to XML. Written in Python 3
sample: file
list:
example 1
example 2
items:
- name: example1
price: 2
- name: example2
price: 3
Result in
<list>example 1 example 2
</list>
<sample>file</sample>
<items>
<price>2</price>
<name>example1</name>
</items>
<items>
<price>3</price>
<name>example2</name>
</items>
This can be executed inside any python environment 3.6+ but I would recommend creating a virtual environment for this purpose and not to break any system
For the user of virtualenv wrapper (my preference), please follow the instructions below:
pip install virtualenvwrapper-win
and linux users pip install virtualenvwrapper
mkvirtualenv _name_at_your_choice
pip install -r requirements.txt
python ./app.py
with the required parametersE.g.: python ./app.py -l <location>/<something>.yml -d <localtion>/<something>.xml
-l
- Location of the file to be parsed (required)-d
- Destination of the file with the file name after parsing (optional)-t
- Whether elements get a data type attribute (defaulting to True. E.g.: <element type="str">
)-s
- Whether the output should be on the screen (defaulting to False)You can run the result only on the screen or just destination or both
python ./app.py -l resources/test.yml -d resources/result.xml -t false -s false
python ./app.py -l resources/test.yml -d resources/result.xml -t false
python ./app.py -l resources/test.yml -t false