xml2aterm — converts an XML document to a comparable ATerm.
f | --input
f | --output
[-S | --silent]
int | --keep
[-h | -? | --help]
The xml2aterm utility is used to convert an XML document to a corresponding ATerm. The ATerm and XML languages are slightly different, so there is a tradeoff between how "natural" the result of the conversion feels and how faithfully it can be converted back into XML.
Since applications have different needs, there are three conversion modes available: implicit, explicit, and very explicit.
The explicit mode is the default mode and supports a roundtrip for almost all ATerms. This means that an ATerm can be converted to XML and back without changing its structure.
The implicit mode does not support such a roundtrip, but the XML is usually more attractive. Use this mode if you only want to export some ATerm to an XML application. The name 'implicit' is related to the more implicit structure in the resulting XML.
The very explicit mode supports a roundtrip for all ATerms. This mode is the way to go if you need the guarantee that a roundtrip preserves the structure of all your ATerms.
The structure of the XML documents in the very explicit mode is generic: there are no language specific elements in these XML documents. The structure is described as a RELAX NG schema.
XML Processing Options
Do conversion in explicit mode. This is the default. See below for details.
Do conversion in very explicit mode. See below for details.
Do conversion in implicit mode. See below for details.
Common Input/Output Options
The input term given by the file name
In the absence of the
-i option, input
will be read from
The output will be written to the file given by the file name
In the absence of the
output will be written to
The output will be written in the binary (BAF) ATerm format.
ATerms in the BAF format require a lot less space than ones in the TAF format, but the Java ATerm library does not currently support baf ATerms. ATerms in the baf format is the preferred format of exchange between Stratego tools.
Common Debugging Options
Display usage information.
Keep intermediate results produced by the internal stages in the
pretty-printing process. This is only useful for debugging. A high
int indicates increased eagerness
for keeping intermediate results.
Default setting is 0, indicating that no intermediates will be kept.
Silent execution. Same as
Set verbosity level to numerical value
higher the number, the more information about pp-aterm's inner workings are
int can be set to either of the
following verbosity levels, given in increasing order of verbosity:
Displays the tool name and version.
Consider the ATerm below.
fred(None, [foo, bar])
In the explicit mode, the corresponding XML would be:
<fred xmlns:at="http://aterm.org"> <None/> <at:list> <foo/> <bar/> </at:list> </fred>
In the very explicit mode, the corresponding XML would be:
<at:appl xmlns:at="http://aterm.org" at:fun="fred"> <at:appl at:fun="None"/> <at:list> <at:appl at:fun="foo"/> <at:appl at:fun="bar"/> </at:list> </at:appl>
In the implicit mode, the corresponding XML would be
<fred xmlns:at="http://aterm.org"> <foo/> <bar/> </fred>
The following terms cannot be encoded into XML in the implicit mode, but will work in either of the explicit noes.
1 "abc" () (1, 2)  [1, 2]
Invocation is straightforward:
$xml2aterm --very-explicit -i tree.trm -o tree.xml
Please report bugs to
Copyright (C) 2002-2005 Eelco Visser
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.