A script for running the command-line interface lives in:
sweetxml-install-path/bin/sweetxml
-x2s | Convert XML to SweetXML. |
-s2x | Convert SweetXML to XML. |
file | Convert file to a new file with the appropriate extension, in the same directory as the input. |
dir | Scan dir for files with the appropriate extension (either .xml or .sxml , depending on whether -x2s or -s2x is specified), converting each. |
- | Convert standard input to standard output. |
To convert specific files from XML to SweetXML:
sweetxml -x2s somefile.xml anotherfile.xml
This creates two new files named somefile.sxml
and anotherfile.sxml
.
To convert files from SweetXML to XML:
sweetxml -s2x somefile.sxml anotherfile.sxml
This creates two new files named somefile.xml
and anotherfile.xml
.
To recursively scan a directory, converting all files ending in .xml
to SweetXML:
sweetxml -x2s somedir
And the reverse:
sweetxml -s2x somedir
The converter also provides a stdin / stdout mode, useful for piping. For example, you might print on online XML document formatted as SweetXML as follows:
curl 'http://foo/bar/somexmldoc' | sweetxml -x2s - | lpr