MyNixOS website logo
Description

A parser driven by a standard RELAX NG schema with concrete syntax extensions.

This package exports a parser executable named parse-concrete. The executable takes two arguments, the target RELAX NG schema filename and the input filename. The input must be well-formed XML. The output of the parser is either an error or XML conforming to the schema.

If the input XML already conforms to the target schema, the parser acts as an ordinary RELAX NG validator. If not, it attempts to insert the missing element tags and to parse the input text nodes into XML elements. The target schema can be enriched by concrete syntax extensions, syntactically compatible with standard RELAX NG, to drive the parsing process.

The included sample RELAX NG schema xhtml-concrete.rng is an extension of, and must be used together with, James Clark's modularized RELAX NG schema for XHTML, which can be downloaded from http://www.thaiopensource.com/relaxng/xhtml/. Here is an example session:

$ cat <<END >test.xhtml.short<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
Title

A paragraph may contain more than one line.
Use *four* (that was emphasized) hyphens to draw a horizontal line:

----

Unnumbered lists are like
* item a
* item b

Numbered lists are like
* item a
* item b
</html>
END
$ parse-concrete xhtml-concrete.rng test.xhtml.short | tee test.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>
Title</title></head><body><p>A paragraph may contain more than one line.
Use <em>four</em> (that was emphasized) hyphens to draw a horizontal line:</p>
<hr/><p>Unnumbered lists are like</p><ul><li>item a</li><li>item b</li></ul><p
>Numbered lists are like</p><ul><li>item a</li><li>item b
</li></ul></body></html>
$ parse-concrete xhtml-concrete.rng test.xhtml | diff test.xhtml -
$
Metadata

Version

0.1.1

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows