XCS to RNG Converter Online - Documentation

Introduction

XCS to RNG Converter Online is a web-based tool to generate Relax NG schemas for validating TBX. A generated RNG will validate any XML file against TBX core structure and the XCS file/data provided.

The web front end is based on JSON Editor Online. All XCS data is dealt with in JSON; you may upload, download, view and edit XCS data using JSON viewer. Regular XML XCS files are converted into JSON and displayed.

Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+.

Website: http://tbxconvert.gevterm.net/rngGenerator.

Contents:

Sample Files

Below are links to sample files; each is a zipped archive containing an XCS file, the same XCS file converted into a JSON format, and the RNG file generated using the XCS 2 RNG tool.

Limitations

The generated RNG does not check the XCS constraints on reference objects (though it might in the future), nor does it check forTermComp for any meta-data category besides termNote; it is unclear to the author what the expected behavior is in this case.

Also, the Relax NG specification does not include full validation of IDREF values; RNG will check that a value is a well-formed IDREF, but not that an element with the specified id actually exists in the file.

Finally, the RNG generator does its best to match the behavior of the TBX Checker, but it differs in some ways. Both tools may, in some respects, be considered more thorough than the other at checking TBX. The missing functionality in TBX Checker is known to be rarely used, while the RNG generator cannot check IDREF validity or DTD adherence (other than core structure), quite commoly used features.

API

Should you choose to use the converter without the front-end, you are of course welcome to download the source or to use our API.

There are two scripts that you can post data to: xcs2rng.php and xcs2json.php.

xcs2rng.php will convert the value of the posted xcs variable to RNG, or alternatively will convert the value of the posted json variable, which should be JSON-encoded XCS. The converted data is downloaded as a file if a filename value is provided, otherwise only an id is returned. This id can be used to retrieve files from fileretriever.json

xcs2json.php will convert the value of the xcs variable to JSON. Similarly to xcs2rng.php, the data is returned as a file if a filename value is provided, or is saved to the server and identified by an id, which is returned instead.


fileretriever.php has a GET interface. When you provide the id of a file and a filename via GET, the file is downloaded. Files are only stored on the server for a maximum of 1 hour. The purpose of saving files on the server and then retrieving them via this script is to allow certain interactions in Javascript (downloading files with AJAX).

How to Use This Tool

Introduction

This tool uses JSON Editor Online, a web-based tool to view, edit, and format JSON. It shows your XCS data in a clear, editable treeview.

The application's main menu contains options to clear, load and save the JSON contents of the application. Files can be loaded and saved on disk, and loading from URL may be supported in the future. The data policy is described here.

Main menu

Data can be loaded from either JSON or XCS files. XCS files are converted into JSON (via the gevterm server) before being displayed.

Load Dialect

The "Load Dialect" option allows you to load XCS data for a particular, standardized dialect. Remember that the generated RNG schemas will check a TBX file against TBX core structure, not against the DTD normally used by a specific dialect (currently the only choice that doesn't use the core structure DTD is TBX-Basic).

Load Dialect Menu

Generate RNG

The Generate RNG button sends the JSON data in the editor to the server, and then downloads an RNG file.

Conversion Errors

The input JSON data must have a correct structure to be usable by the RNG generation program. Every section of the data is required to be a certain type of data structure, and sometimes is required to contain certain data. Conversion errors are displayed in a red popup:

Example Error Message

This message would be displayed if you changed the language specification to be an array instead of an object, as shown below.

Example Error Message Example Error Message

Editor

The JSON Editor displays the JSON data in an editable tree. The editor makes it easy to create, duplicate and remove fields, and to edit the contents of the fields.

The menu of the editor contains the following functions:

The field values in the editor are editable input fields. The fields can be dragged up and down using the dragarea on the left side of the fields. When a field is the last item of the children of an array or object, the field can also be dragged horizontally to move it in or out of the array or object.

Right from the dragarea is a button to open the actions menu. Depending on the type of field, the following functionality is available in the actions menu:

Shortcut keys

The JSON Editor supports shortcut keys for all available actions. The editor can be used by just a keyboard. The following short cut keys are available:

KeyDescription
Alt+ArrowsMove the caret up/down/left/right between fields
Shift+Alt+ArrowsMove field up/down/left/right
Ctrl+DDuplicate field
Ctrl+DelRemove field
Ctrl+EnterOpen link when on a field containing an url
Ctrl+InsInsert a new field with type auto
Ctrl+Shift+InsAppend a new field with type auto
Ctrl+EExpand or collapse field
Alt+EndMove the caret to the last field
Ctrl+FFind
F3, Ctrl+G
Find next
Shift+F3, Ctrl+Shift+GFind previous
Alt+HomeMove the caret to the first field
Ctrl+MShow actions menu
Ctrl+ZUndo last action
Ctrl+Shift+ZRedo