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

[ parsing, program, xml ] [ Propose Tags ] [ Report a vulnerability ]

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 -
$

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1
Dependencies base (<5), cmdargs (>=0.9 && <0.11), containers (>=0.4 && <0.6), hxt (>=9.2 && <10), hxt-charproperties (>=9 && <10), hxt-curl (>=9.1 && <9.2), hxt-relaxng (>=9.1 && <9.2), hxt-tagsoup (>=9.1 && <9.2) [details]
Tested with ghc >=0
License LicenseRef-GPL
Copyright Copyright (C) Stilo International plc, 2012
Author Mario Blazevic
Maintainer mblazevic@stilo.com
Category Parsing, XML
Uploaded by MarioBlazevic at 2012-08-23T02:10:22Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables parse-concrete
Downloads 1932 total (1 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2016-11-11 [all 11 reports]