~srushe/cricsheet-xml-converter

Generate XML from Cricsheet YAML data
318b7fe3 — Stephen Rushe 5 months ago
Update convert.rb to correctly sort XML
87bb4a08 — Stephen Rushe 5 months ago
Update schema
ca6eabbe — Stephen Rushe 10 months ago
Fix link to cricsheet-xml

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~srushe/cricsheet-xml-converter
read/write
git@git.sr.ht:~srushe/cricsheet-xml-converter

You can also use your local clone with git send-email.

#xml-converter

A collection of small ruby scripts to convert version 0.9 Cricsheet YAML data files into XML, and to allow validation of the XML against the schema file (schema.xsd).

These scripts are used to generate the XML data available in the Cricsheet XML project.

#Installation

You can manage the dependencies using Bundler. Once you have it installed you can install the dependencies using:

$ bundle install

#Usage

convert.rb is a ruby script, which can be configured using command-line arguments. See ./convert.rb --help for all available options.

validate.rb is also a ruby script, which cannot be configured. It simply takes a list of XML files to be validated against the schema, and outputs any errors it finds for each file.

#Examples

#Converting YAML to XML

In all of the examples that follow the resulting XML will be saved with with a .xml extension. For example, foobar.yaml will be converted to foobar.xml.

Convert a single YAML file, and save the resulting XML into the default output folder (./tmp).

$ ./convert.rb data.yaml

Convert the provided YAML files, and save the resulting XML into the default output folder (./tmp).

$ ./convert.rb *yaml

Convert the provided YAML files, and save the resulting XML into a specified folder.

$ ./convert.rb -f some/other/folder 1.yaml 2.yaml

#Validating XML

Validate a single XML file against the schema.

$ ./validate.rb data.xml

Validate multiple XML files against the schema.

$ ./validate.rb data.xml other_data.xml

#Credits

Thanks to Rob Mohseni for the initial version of the schema file, which I then extended. Without his efforts the XML version would never have happened.