Using rnginline From the Command Line ===================================== Firstly, ensure you've :doc:`installed rnginline `. Basic Usage ----------- Basic usage is: .. code-block:: console $ rnginline my-nested-schema-root.rng flattened-output.rng If the second argument is not given, output goes to stdout, so you can pipe it through ``xmllint --format`` or similar: .. code-block:: console $ rnginline schema.rng | xmllint --format - abc EOF $ cat > external.rng <<'EOF' EOF Flatten ``schema.rng`` and everything it includes into a single XML document, re-indent it with ``xmllint`` and save the output in ``out.rng``: .. code-block:: console $ rnginline schema.rng | xmllint --format - > out.rng $ cat out.rng
abc
The resulting schema acts as expected — the ``foo`` definition from ``external.rng`` has been overridden: .. code-block:: console $ xmllint --relaxng out.rng - <<'EOF' abc 123 EOF abc 123 - validates Advanced Usage -------------- This section describes some less common use cases. Passing the input on stdin ^^^^^^^^^^^^^^^^^^^^^^^^^^ You can send the root schema on stdin, but doing so means rnginline won't know the location of the file, which means it can't resolve relative references in the input without extra information. To prevent casual use of stdin without realising the issues, the ``--stdin`` option must be passed in place of the input file. To tell rnginline where the schema on stdin is from, use the ``--base-uri`` option. If you don't specify a base, the paths of included files will be relative to the current directory. Here's a (contrived) example of pre-processing the input before passing it on stdin: .. code-block:: console $ xmllint --format - < /tmp/schema.rnc | rnginline --base-uri /tmp/schema.rnc --stdin