aterm2xml — translates an ATerm to XML
aterm2xml
[--explicit]
[--very-explicit]
[--implicit]
[-i file
| --input file
]
[-o file
| --input file
]
[-b]
[-S | --silent]
[--verbose level
]
[-k level
| --keep level
]
[-h | -? | --help]
[--about]
[--version]
The aterm2xml utility is used to convert an ATerm to a corresponding XML. 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
--explicit
Do conversion in explicit mode. This is the default. See below for details.
--very-explicit
Do conversion in very explicit mode. See below for details.
--implicit
Do conversion in implicit mode. See below for details.
Common Input/Output Options
-i file
The input term given by the file name
.
file
In the absence of the -i
option, input
will be read from stdin
.
-o file
The output will be written to the file given by the file name
.
file
In the absence of the -o
option,
output will be written to stdout
.
-b
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
--about
See --version
.
-h
, -?
, --help
Display usage information.
--keep int
Keep intermediate results produced by the internal stages in the
pretty-printing process. This is only useful for debugging. A high
value of int
indicates increased eagerness
for keeping intermediate results.
Default setting is 0, indicating that no intermediates will be kept.
-S
, --silent
Silent execution. Same as --verbose
.
0
--verbose int
Set verbosity level to numerical value int
. The
higher the number, the more information about pp-aterm's inner workings are
printed.
Alternatively, int
can be set to either of the
following verbosity levels, given in increasing order of verbosity:
emergency
, alert
, critical
,
error
, warning
, notice
,
info
, debug
, vomit
.
--version
Displays the tool name and version.
The following will convert the term A([], "b") to its implicit XML representation:
$
echo "A([1], \"b\")" | aterm2xml --implicit
<?xml version="1.0" ?> <A xmlns:at="http://aterm.org">1b</A>
The following will convert the term A([], "b") to its explicit XML representation:
$
echo "A([1], \"b\")" | aterm2xml --explicit
<?xml version="1.0" ?> <A xmlns:at="http://aterm.org"><at:list><at:int>1</at:int></at:list><at:string>b</at:string></A>
The following will convert the term A([], "b") to its very explicit XML representation:
$
echo "A([1], \"b\")" | aterm2xml --very-explicit
<?xml version="1.0" ?> <at:appl xmlns:at="http://aterm.org" at:fun="A"><at:list><at:int><at:value>1</at:value></at:int></at:list><at:string><at:value>b</at:value></at:string></at:appl>
See xml2aterm for more examples.
Copyright (C) 2002-2005 Eelco Visser <visser@acm.org>
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.