arx man page

arx — automatically determines the type of an XML document


arx [Options] document.xml {config_file.conf ...}


ARX is a tool to automatically determine the type of a document from its name and contents. It is inspired by James Clark's schema location approach for nXML.


ARX either prints a string corresponding to the document's type or nothing if the type cannot be determined. You can specify configuration files to override defaults in /etc/arx.conf. The options are:


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)


prints current version


displays usage summary and exits



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 configuration below associates documents with grammars for XSLT, DocBook or XSL FO.

grammars {

valid {
start = element (book|article|chapter|reference) {any}
any = (element * {any}|attribute * {text}|text)*
} => docbook

!valid {
default namespace xsl = ""
start = element *-xsl:* {not-xsl}
not-xsl = (element *-xsl:* {not-xsl}|attribute * {text}|text)*
} => xslt

=~/.*.xsl/ => xslt
=~/.*.fo/ => xslfo



Michael Simacek <>. This man page was made from the readme written by RNV's author David Tolpin <>.

See Also

rnv(1), rvp(1), xmllint(1), xmlstarlet(1), trang(1)

Referenced By