arx(1) - Linux man page
Name
arx - Automatically determine the type of a document from its name and contents
Synopsis
arx {-n | -v | -h} document.xml arx.conf {arx.conf}
- ARX either prints a string corresponding to the document's type or nothing if the type cannot be determined. The options are:
-n
- turns off prepending base path of the configuration file to the result, even if it looks like a relative path (useful when the configuration file and the grammars are in separate directories, or for association with something that is not a file);
- -v
- prints version number;
- -h
- displays usage summary and exits.
The Configuration File
The configuration file must conform to the following grammar:
-
arx = grammars route* grammars = "grammars" "{" type2string+ "}" type2string = type "=" literal type = nmtoken route = match|nomatch|valid|invalid match = "=~" regexp "=>" type nomatch = "!~" regexp "=>" type valid = "valid" "{" rng "}" "=>" type invalid = "!valid" "{" rng "}" "=>" type literal=string in '"', '"' inside must be prepended by '\' regexp=string in '/', '/' inside must be prepended by '\' rng=Relax NG Compact Syntax Comments start with # and continue till the end of line. - Rules are processed sequentially, the first matching rule determines the file's type. RELAX NG templates are matched against file contents, regular expressions are applied to file names. The sample below associates documents with grammars for XSLT, DocBook or XSL FO.
-
grammars { docbook="docbook.rnc" xslt="xslt.rnc" xslfo="fo.rnc" } valid { start = element (book|article|chapter|reference) {any} any = (element * {any}|attribute * {text}|text)* } => docbook !valid { default namespace xsl = "http://www.w3.org/1999/XSL/Transform" start = element *-xsl:* {not-xsl} not-xsl = (element *-xsl:* {not-xsl}|attribute * {text}|text)* } => xslt =~/.*\.xsl/ => xslt =~/.*\.fo/ => xslfo - ARX can also be used to link documents to any type of information or processing.
Authors
David Tolpin
- Developer
- Thomas Schraitle
- Manpage