CONVERT
From ICE Enterprises
Converts Midas file data and or header to other formats
<IN> - Input file, table or other object
<CONV> - Type of conversion to perform (see list of functions below)
<OUT> - Output file or object
<FORM> - Format list for the T2B option
<SKIP> - Records to skip for the T2B option
Keyword Only Parameters:
[IMGOPTS] - Table of options that may be used to alter the appearance of a
PNG/JPG/GIF Image file. Used in BLUE2IMG conversion. See
BLUE2IMG below for more details of IMGOPTS.
[OPTIONS] - Table of keys and their values that extend additional options to
the user for CONVERT methods. Options may specify anything from
an icon color to how to format the output data. Options are
autonomous to the CONVERT method being used. Reference the
explanation section for the desired method below for further
information.
[EPOCH] - Reference epoch for output file.
[QUADWORDS] - Reference frame quadwords for output file. This supports:
ALT= - Altitude (meters)
LAT= - Latitude (deg)
LON= - Longitude (deg)
AZIM= - Azimuth (deg)
ELEV= - Elevation (deg)
ROLL= - Roll (deg)
[TIMES] - File containing timecode reference for SVINTERP function.
[TIMESPEC] - Table containing start/stop/delta for SVINTERP function.
{START=<start_time>,STOP=<stop_time>,DELTA=<time_delta>}
This routine converts Midas files or other objects to different formats.
NOTE: Unlike X-Midas, which has a 26 subrecord limit, there is NO restriction on
the number of subrecords in type 3000 files. So if you are trying to create a
file readable by X-Midas you must create items, like XML or CSV, that fit within
these constraints.
Since NeXtMidas 2.5.0, the FILE command provides some facilities for copying
between different file formats (e.g. CSV to BLUE and BLUE to CSV). See FILE
for more details.
FUNCTIONS:
EEEI, IEEE, VAX
Convert a Midas data file (BLUE) header and data the numeric representation
given. This overwrites the current file unless <OUT> is given.
PACKED, BYTE, INT, LONG, FLOAT, DOUBLE
Convert the Midas data file to the given format type.
ECI, ECR, TOP, TOPOCENT [Since NeXtMidas 3.3.0]
Converts the reference frame in a Type 5000 and the associated POS, VEL, and
ACC values to:
ECI - Earth-centered inertial
ECR - Earth-centered rotational (also known as Earth-Centered,
Earth-Fixed, ECEF or ECF)
TOP - Modified topocentric
TOPOCENT - Topocentric
The [EPOCH] and [QUADWORDS] parameters can be used to configure the
output reference frame.
If a TIME column is specified in the input file, it will be assumed to
contain the time of the entry in J1950 seconds (i.e. overriding the normal
computation that assumes all entries are evenly spaced based on xdelta). In
this case, output file will also include a TIME column which corresponding
to the time of the entry and matching the input value.
CARTESIAN, SPHERICAL, CYLINDRIC, ELLIPSOID, GEODETIC [Since NeXtMidas 3.3.0]
Converts POS, VEL, and ACC values in a Type 5000 file to the given
coordinate system. The [EPOCH] and [QUADWORDS] parameters can be used to
provide limited adjustments to the output reference frame.
BLUE2XML[/S] <Beta Version> [Since NeXtMidas 3.5.4]
Convert BLUE Midas file (any type) into an XML file.
Syntax:
CONVERT <IN> BLUE2XML <OUT> OPTIONS={...}
Modifiers:
/S - Indicates output to string instead of a XML text file.
OPTIONS:
VERSION - Version for the converted output. [DEF="1.0"]
OUTER_TAG - The desired outer XML tag. [DEF="MidasXML"]
NEWLINES - Should the XML be generated in a more readable format with
newlines and indentation? If this is false no extra
whitespace will be added. [DEF=true]
BLOCKDATA - Should the Type 1000 and Type 2000 data be written as a block?
[DEF=false if format type is 'A', otherwise true]
NOTE: Per the BLUE file format, non-printable characters are not recommended
in type 'A' (ASCII) keyword data values. If encountered, the behavior
during conversion and the reverse conversion is undefined.
Example:
nM> CONVERT apenny.prm BLUE2XML apenny.xml
XML2BLUE[/S] <Beta Version> [Since NeXtMidas 3.5.4]
Convert XML file into a BLUE Midas file. This is the reverse of BLUE2XML.
Modifiers:
/S - Indicates input from string instead of a XML text file.
Syntax:
CONVERT <IN> XML2BLUE <OUT> OPTIONS={...}
OPTIONS:
WARN - Show warnings. [DEF=true]
WARN: There is a known issue converting an XML file (of a previously
converted Type 6000 file where num_elts > 1 in the subrecord
definition) back to BLUE (see Bug 2959).
BBDEF2JAVA
Translates a ByteBuffer wrapper definition at the top of a Java file to
actual Java methods. This is safe to run multiple times on the same file
to update the code to match any changes to the definitions.
Example:
nM> CONVERT nxm.sys.libxm.Mc.java BBDEF2JAVA
CSV2TBL
Convert Comma-separated values (CSV) into a table.
CSV2XML
Convert Comma-separated values (CSV) into an XML File.
Since NeXtMidas 2.9.0, this conversion will add the '.xml' extension to the
output file if the user does not specify any extension.
FILE2XML[/S] <Beta Version> [Since NeXtMidas 3.5.4]
Convert a file (BLUE, CSV, e.g. any file that implements ListFile or
PlotFile interface) to XML (file or results String). See XML2BLUE function
for options.
Syntax:
CONVERT <IN> FILE2XML <OUT> OPTIONS={...}
Modifiers:
/S - Indicates output to string instead of a XML text file.
FSTRUCT2JAVA
Converts a Fortran structure definition in an include file into a wrapped
ByteBuffer in Java where <FORM> is the name of the structure to wrap (case
sensitive). If a single static structure is being wrapped use the /VARIABLE=
switch to specify the variable name (case sensitive). This can also be used
to just convert all of the parameter constants to Java (in this case the
structure name is the empty string).
Syntax:
CONVERT <IN> FSTRUCT2JAVA <OUT> <struct_name>
Example:
nM> CONVERT/INCLUDE="<midas.h>"/VARIABLE="Mc" &
midas.inc FSTRUCT2JAVA nxm.sys.libxm.Mc.java "MCOMMON"
nM> CONVERT/CLASSSUB="TypeClass" &
header.inc FSTRUCT2JAVA nxm.sys.libxm.Header.java "HEADER"
nM> CONVERT /home/xmmgr/xm-3_8_3/xm/host/xgeoplot.inc &
FSTRUCT2JAVA nxm.ucl.inc.Params.java ""
KWCONV <Beta Version> [Since NeXtMidas 3.7.0]
Converts the incoming file's keywords to new keywords using the specified
conversion table.
Syntax:
CONVERT <IN> KWCONV <OUT> [OPTIONS={keyword_conversion_table}]
Example:
1. Use the general Keyword conversion command KWCONV to convert (select)
Platinum Keywords to BLUE Keywords.
nM> table converttable LOAD kwconv_plat2blue.tbl
nM> CONVERT testplat4plat2blue.cdif KWCONV testbluefromplat.tmp &
options=converttable
LLA2ECI [Since NeXtMidas 3.3.0]
Converts a static LON/LAT/ALT position to an ECI state vector. If [OPTIONS]
is not specified the default values will be used (START=<epoch>,DELTA=60,
ELEM=1440). Note that [EPOCH] is required for ECI conversions.
nM> CONVERT {LON=<lon>,LAT=<lat>,ALT=<alt>} LLA2ECI <OUT> &
OPTIONS={START=<start_time>,DELTA=<time_delta>,&
ELEM=<num_points>} &
EPOCH=<epoch>
LLA2ECR [Since NeXtMidas 3.3.0]
Converts a static LON/LAT/ALT position to an ECR state vector. If [OPTIONS]
is not specified the default values will be used (START=<epoch>,DELTA=60,
ELEM=1440). Note that [EPOCH] is only required for ECR conversions if the
start time is omitted.
nM> CONVERT {LON=<lon>,LAT=<lat>,ALT=<alt>} LLA2ECR <OUT> &
OPTIONS={START=<start_time>,DELTA=<time_delta>,&
ELEM=<num_points>} &
EPOCH=<epoch>
MSGCFG2TBL
Converts an X-Midas messages.cfg file to a table file which is used when
converting between X-Midas messages and NeXtMidas messages. (This is only
used when using the XBC option tree or running NeXtMidas as an X-Midas
option tree.) Expects <IN> to be the option tree being used, output files
are automatically named.
Example (for XBC):
nM> CONVERT XBC MSGCFG2TBL
Example (for NeXtMidas as an X-Midas option tree):
nM> IMPORT XMDISK XMDISK
nM> IMPORT XM_PATH XM_PATH
nM> CONVERT/XMDISK="^{XMDISK}"/PATH="^{XM_PATH}" SYS MSGCFG2TBL
MSGCFG2INC
Similar to MSGCFG2TBL, converts an X-Midas messages.cfg file to the Fortran
include files and C/C++ header files used by XBC (these files match those
X-Midas generates with GENMSGINC).
Example:
nM> CONVERT XBC MSGCFG2INC
MSGCFG2XML (Not Implemented)
Similar to MSGCFG2XML, converts an X-Midas messages.cfg file to the XML
definition file.
Example:
nM> CONVERT XBC MSGCFG2XML
PLAT2BLUE <Beta Version> [Since NeXtMidas 3.7.0]
Converts the incoming file's Platinum keywords to the corresponding BLUE
keywords (as defined by the JICD 4.2 ICD). The default behavior is to NOT
copy over the Platinum keywords to the new file, as that might result in
inconsistencies if the file is modified.
Syntax:
CONVERT <IN> PLAT2BLUE <OUT> [OPTIONS={table_of_additions_and_overrides}]
Examples:
1. Convert (select) Platinum Keywords to BLUE keywords, specifying TOA_SIGMA
and FOA_SIGMA to enable covariance keywords to be converted. Keep the
existing Platinum keywords.
nM> CONVERT testplat4plat2blue_cov.cdif PLAT2BLUE testbluefromplat.tmp &
options={_OPTIONS_={KEEP_EXISTING=true}, &
TOA_SIGMA={VALUE=0.0},FOA_SIGMA={VALUE=0.0}}
2. Convert (select) Platinum Keywords to BLUE keywords, specifying TOA_SIGMA
and FOA_SIGMA to enable covariance keywords to be converted. Do not copy
over the Platinum keywords.
nM> CONVERT testplat4plat2blue_cov.cdif PLAT2BLUE testbluefromplat.tmp &
options={TOA_SIGMA={VALUE=0.0},FOA_SIGMA={VALUE=0.0}}
3. Convert (select) Platinum Keywords to BLUE Keywords. Since there are no
covariance keyword, SYSTEM_TOA_SIGMA and SYSTEM_FOA_SIGMA should be
specified, but it is not required.
nM> CONVERT testplat4plat2blue.cdif PLAT2BLUE testbluefromplat.tmp
POLY2KML[/S] - (type 1999 only) [Since NeXtMidas 3.3.2]
Convert a Type 1999 Poly file to a KML File. The lines in the 1999 file
become KML <LineString> segments. The color of the <LineString> is denoted
by the color index given in the file, unless a ColorMap is specified in
the OPTIONS table.
Syntax:
CONVERT <IN> POLY2KML <OUT> [OPTIONS]
Modifiers:
/S - Indicates output to string instead of a text file; to results
specified by <OUT>, otherwise to the terminal.
OPTIONS:
CMAP - Alternate ColorMap to use
LINEWIDTH - Width of the line segments, in pixels [DEF=2]
Examples:
1. Convert the world.prm file to KML
nM> convert world.prm poly2kml worldkml.kml
2. Convert the world.prm to a RESULT String instead of a file
nM> convert world.prm poly2kml/s worldkmlstring
T2B - Text-to-Blue (type 1000 or 3000)
Takes a text file with the extension .TXT and converts it to a BLUE Midas
file of the same name with a .TMP extension. The conversion is handled
according to the format string <FORM>. If there are multiple fields,
the data is written to a Type 3000 record oriented file. The format is
specified by Midas format codes with an added field length as shown here:
<FORM> = F10|A6|X4|B3|2L5|2X|A32
This example reads the first 10 characters of each record as a Float value,
the next 6 characters as an ASCII value, skips 4 spaces, the next 3 chars as
a Byte value, the next 5 as a Long, the next 5 as a Long, skips 2 spaces,
and the last 32 characters as an ASCII value. Also the first <SKIP> records
of the input file may be skipped in this mode.
If the /PARSE switch is present, the input lines are parsed using white
space or commas as delimiters. The field lengths are ignored. This is
useful for CSV files.
TBL2B - (type 3000 only) Converts a table into a blue type-3000 file.
By default, formats are SD or SA as determined by the first row in the
table. If the field can be converted into a double that column is deemed
SD, otherwise the column is SA. Any column's format may be overridden on
the command line with:
FORM=<field1=format1>|<field2=format2>...|<fieldn=formatn>
where field<x> is the name of the field in the table, NOT the record name
in the type-3000 file. Formats are the usual SA, 3A, SD, SF, SI, SB, ...
NOT those used for the T2B option.
The input table must conform to the type-3000 file structure; that is, it
must be a table with 1..n rows of sub-tables of the same structure. If
there are tables in the sub-tables it can not be converted.
NOTE: The order of the type-3000 columns will most-likely NOT match the
order of the table fields.
BLUE2IMG - (type 2000 only) [Since NeXtMidas 2.7.3]
Converts a Type 2000 file to an image file. The original file is not
altered. Adjustments are made to the produced image based on the data in the
IMGOPTS table, if provided. If the output file name is not specified, the
file will be called "<input_file_name>.<out_image_format>", where
"<input_file_name>" does not include the path or extension, and
<out_image_format> is PNG, GIF, or JPG.
Syntax:
CONVERT <IN> BLUE2IMG <OUT> FORM=<out_image_format> IMGOPTS={...}
IMGOPTS:
ALPHA - (int) Adjust the Alpha (Transparency) on the image. This is a
value between 0 (transparent) and 255 (opaque). A value of -1
indicates no change. [DEF=-1]
BRT - (int) Adjust the Brightness on the image. This is a value
between 0 and 100, which correlates to percentage Contrast. A
value of -1 or 50 indicates no change. [DEF=50]
CMAP - (String) Defined ColorMap, such as TERRAIN, MULTI, etc.
See MColor API for list of defined ColorMaps. [DEF=RAMP]
CNT - (int) Adjust the Contrast on the image. This is a value
between 0 and 100, which correlates to percentage Contrast.
A value of -1 or 50 indicates no change. [DEF=50]
COLORS - (String) Comma-separated list of colors which will be used to
create a custom ColorMap. If present, this will override CMAP.
CTHRU - (boolean) Whether or not to transform the color for Zero (0)
values, which is usually the absence of data (the background),
totally transparent. [DEF=FALSE]
NOTE: As of 3.1.0, this no longer does anything. Use a custom
color map if a transparent color is required.
CXMODE - (String) Complex Mode. Used when the input file contains
complex data. Must be in MAG [DEF], PHASE, REAL, IMAG, 10LOG,
20LOG. (Since 3.1.0)
GRAYSCALE - (boolean) Whether or not to produce the image in GreyScale.
NC - (int) Number of colors to use in the ColorMap. [DEF=256]
ZMAX - (double) Maximum data value to accept / draw. No default.
ZMIN - (double) Minumum data value to accept / draw. No default.
Examples:
1. Use a custom colormap with 13 colors.
nM> res colors "black,blue,cyan,darkGray,gray,green,yellow,lightGray,&
magenta,orange,pink,red,white"
nM> convert altitude blue2img "testAlt1.png" png IMGOPTS={nc=13,&
colors="^colors"}
2. Create the image in grayscale, using the TERRAIN ColorMap.
nM> convert altitude blue2img "testAlt2.gif" gif &
IMGOPTS={cmap=terrain,grayscale=TRUE}
3. Adjust the contrast and brightness on the output file to 100%.
nM> convert altitude blue2img "testAlt3.jpg" jpg &
IMGOPTS={cmap=terrain,cnt=100,brt=100}
4. Adjust the contrast and brightness on the output file to 100%, make the
image semi-transparent, and use the TERRAIN ColorMap with 1024 colors.
nM> convert altitude blue2img "testAlt4.jpeg" jpeg &
IMGOPTS={cmap=terrain,nc=1024,cnt=100,brt=100,alpha=128}
5. Simply create the image using the TERRAIN ColorMap.
nM> convert altitude blue2img "testAlt5" IMGOPTS={cmap=terrain}
6. Create the image only from a specified data range.
nM> convert altitude blue2img "testAlt6.gif" GIF &
IMGOPTS={cmap=terrain,z1=-1000,zmax=1000,cthru}
7. Create an image from a datafile containing complex PHASE data
nM> convert myComplexDataFile blue2img "myCXImg.jpg" jpg &
IMGOPTS={CXMODE=PHASE}
SV2BLUE [Since NeXtMidas 3.3.2]
Converts a state vector to a Type 5001 BLUE file. This will take in any of
the state vector forms supported by StateVector and outputs a Type 5001
file.
Syntax:
CONVERT <IN> SV2BLUE <OUT> OPTIONS={INTERPOLATIONORDER=<order>}
The OPTIONS table can be used to override options of the StateVector class
used prior to interpolation. Typically this will include setting the
InterpolationOrder used to one of the following:
"Linear" - Linear Interpolation
"CubicHermite" - Cubic Hermite Spline
"QuinticHermite" - Quintic Hermite Spline
By default this will output only the POS, VEL, and ACC columns (omitting ACC
if not available in the input file). If a TIME column is desired this can
be indicated by adding the "TIME_NAME=TIME" qualifier to the output file
(this qualifier matches the FILE command, except that the value must be
"TIME" in this usage). This will always "auto SVINTERP" the input data such
that it is evenly spaced as is required in a typical Type 5001 file.
Examples:
1. Convert vehicle #4 in a given SP3 file to a BLUE file and plot it:
nM> convert nga17212.sp3{SELECTED=4} sv2blue ram:temp
nM> plot world.prm|ram:temp
SV2KML[/S] - (type 5000 only) [Since NeXtMidas 3.1.1]
Converts Type 5000 state vectors to a KML file.
** THE SV2KML FUNCTION IS EXPERIMENTAL AND HAS KNOWN ISSUES **
The original file is not altered and the output file is created based on
the OPTIONS table and the times provided. If the output file name is not
specified, the file will be called "<input_file_name>.kml", where
"<input_file_name>" does not include the path or extension. State vectors
are identified by times given by user. These are relative times to the
file given. If the user does not provide specific times, the entire file
will be outputted. The OPTIONS table gives the user various controls to
influence the KML output with style information or format preferences.
A list of supported options can be found below along with examples.
Syntax:
CONVERT <IN> SV2KML <OUT> [OPTIONS]
Modifiers:
/S - Indicates output to string instead of a text file; to results
specified by <OUT>, otherwise to the terminal.
OPTIONS:
ALTMODE - (String) Specifies how altitude components in the
<coordinates> element are interpreted. [DEF=clampToGround]
* clampToGround: Indicates to ignore an altitude specification
* relativeToGround: Sets the altitude of the element relative
to the actual ground elevation of a
particular location
* absolute: Sets the altitude of the coordinate relative to
sea level, regardless of the actual elevation of
the terrain beneath the element.
BEGIN - (long) Start time for TimeSpan purposes. [DEF=TIMESTAMP]
DELTA - (long) Delta to be used. [DEF=input file's delta]
END - (long) Start time for time-span purposes. [DEF=TIMESTAMP]
EXTRUDE - (long) A boolean that decides whether to connect the point/
line/ring to the ground. Given as a num. [DEF=0]
FORMAT - (String) KML format to use for output: [DEF=POINT]
* Point: Geographic location defined by lon, lat, & (opt) alt
* LineString: Defines a connected set of line segments
* Model: A 3D object described in a COLLADA file
* gx:Track: Currently not supported
HEADING - (long) Azimuth of the camera, in deg. [DEF=0,true North]
HREF - (String) HTTP address or local file for icon. [DEF=None]
ICONCOLOR - (String) Hex value for icon color. [DEF=FFFFFFFF]
ICONSCALE - (long) Resizes the icon. [DEF=1]
LABELSCALE - (long) Resizes the label [DEF=1]
LABELCOLOR - (String) Hex value for label color. [DEF=FFFFFFFF]
LINECOLOR - (String) Hex value for line color. [DEF=FFFF0000]
LINEWIDTH - (long) Width of the line, in pixels. [DEF=1]
PERSIST - (long) A boolean that specifies whether to maintain
previously plotted points. BEGIN and ENG must be
define for this to be applied. [DEF=0]
PREPEND - (String) User-option to specify color, scale and width in
style section of a point or line string format.[See Option]
ROLL - (long) Rotation, in degrees, of the camera around the Z axis.
Values range from -180 to +180 [DEF=0]
STYLEID - (String) Name of KML style section. [DEF=STYLEID]
TESSELLATE - (long) A boolean that specifies whether to allow the line/
ring to follow the terrain. [DEF=0]
TILT - (long) Rotation, in degrees, of the camera around the
X axis. [DEF=0]
TIME - (Data) Specific times given for a Type 5000 file. These
times will be translated into lat,lon and alt, and they are
treated as absolute. Times should be given as comma
separated doubles within parentheses. This is not necessary
for a single time. If no times are given and if the 'begin'
and 'end' options have not been specified for a TimeSpan,
then all points from the input file will be converted to
coordinates for the output. [DEF=all elements in file]
XSCALE - (long) Scales a model along the X axes. [DEF=1]
YSCALE - (long) Scales a model along the Y axes. [DEF=1]
ZSCALE - (long) Scales a model along the X axes. [DEF=1]
Examples:
1. Create a KML file with a KML Point at a position equating to the
position of sv3.prm at a time offset of 3000
nM> CONVERT sv3.prm SV2KML output.kml OPTIONS={time=3000}
2. Display a KML formatted String in the terminal that contains
two KML Points from sv3.prm at time offsets 8000 and 9000. Also,
use a Collada model for the icon image.
nM> CONVERT sv3.prm SV2KML/S OPTIONS={format="MODEL",&
time=(8000,9000),xscale=4000,yscale=4000,zscale=4000,&
href="http://alice.techma.com/nextmidas/erc/35a.dae"}
3. Create a KML file with a KML LineString connecting points
from data in sv3.prm between time offset 3000 and 4300.
nM> CONVERT sv3.prm SV2KML output.kml OPTIONS={format=linestring,&
iconscale=4,iconcolor=#FF0000,begin=3000,end=4300}
SVINTERP [Since NeXtMidas 3.3.0]
Creates a Type 5000 state vector by interpolating values from an existing
Type 5000 with given time indices. The time indices are specified via the
TIME column in a Type 3000/5000/6000 file. This function takes the place of
X-Midas commands like SVINTERP_TC.
Syntax:
CONVERT <IN> SVINTERP <OUT> TIMES=<time_file> &
OPTIONS={INTERPOLATIONORDER=<order>}
-or-
CONVERT <IN> SVINTERP <OUT> &
TIMESPEC={START=<start_time>,STOP=<stop_time>,DELTA=<time_delta>}
The OPTIONS table can be used to override options of the StateVector class
used prior to interpolation. Typically this will include setting the
InterpolationOrder used to one of the following:
"Linear" - Linear Interpolation
"CubicHermite" - Cubic Hermite Spline
"QuinticHermite" - Quintic Hermite Spline
The TIMES=<time_file> parameter may be either a Type 3000/5000/6000 file
with a TIME column or a file with TCWS and TCFS columns (such as an
ICEPacket file, which matches the input to the X-Midas SVINTERP_TC). If all
three columns (TIME,TCWS, and TCFS) are given, the TIME column will be used.
If a TIME column is specified in the <IN> file, it will be assumed to
contain the time of the entry in J1950 seconds (i.e. overriding the normal
computation that assumes all entries are evenly spaced based on xdelta).
Time, when not available in a file, can also be specified using the TIMESPEC
parameter. TIMESPEC is a table containing START, STOP, and DELTA times.
TBL2HTML - Converts a NeXtMidas results table into an HTML text file.
If an extension is not included, the output file will be named
<out>.html.
NOTE: This conversion was designed to be part of the NeXtMidas macro test
suite. As such, any table values that are equal to "1" or startWith
"PASSED ALL TESTS" will have table cells with a background color of green
("009900"). Any table values that are equal to "-1" or start with
"FAILED SOME TESTS" will have table calls with a background color of red
("F00000"). All other cells will have a background of light grey. Custom
cell colors require editing nxm.sys.prim.convert.java with the desired
cellColor and recompiling.
TAB2XML[/S] - Converts a table into an XML text file or string
Since NeXtMidas 2.9.0, this command will add a '.xml' extension if the
user does not specify a different one.
The newlines option under the FLAGS switch can be used to control
indentation and new line insertion. The /DELIM switch is used to control
how XML tags with the same name are handled (tables must have unique key
names). For example,
'<XML><ROW>A=1</ROW><ROW>A=2</ROW><XML>'
becomes a table with keys
Tables with inner tables take the XML form:
<XML><INNER ATTR1="..." ATTR2="..." ... /></XML>
Tables WITHOUT inner tables take the XML form:
<XML ATTR1="..." ATTR2="..." ... />
Modifiers:
/S - Indicates output to string instead of a text file
TBL2XML[/S] - DEPRECATED. Use TAB2XML
TEMPLATE2TBL[/F] - Converts the X-Midas template in a given file to a
table that can be used as a template with LIST2. (See Example 9)
Modifiers:
/F - Indicates output to Table (.tbl) file rather than a result.
XML2B - Converts an XML text file into a BLUE file.
The /XMLKEY switch is used to indicate the table to be converted. The
record names are gleaned from the XML field names, with a limit of 4
characters. So lookout for duplicate field names - a fix is TBD!
XML2B is essentially a combination of the XML2TBL and TBL2B conversions,
thus see these for more information.
XML2TAB - Converts an XML text file into a Table object.
XML2TAB/S - Converts an XML string into a Table object.
By default this does a "FAST" conversion which means that most XML validity
checks are skipped. If an error occurs (likely due to malformed XML input)
a warning will be printed and no output result will be set. Note that the
warning message will rarely indicate the real reason the conversion failed,
in many cases the exception is not seen until some time after the initial
error. In a few rare cases errors may go undetected. The "FAST" conversion
assumes that there will only be one root level element. If multiple top
level elements exist, only the last root element will be returned.
For example:
<ROOT1><DATA>Hello</DATA></ROOT1> <ROOT2><DATA>World</DATA></ROOT2>
only returns a table representing
<ROOT2><DATA>World</DATA></ROOT2>
Examples:
nM> convert airports.xml XML2TAB tab
Switches:
/BASE -- See documentation on switches below and in TAB2XML
/COMP -- See documentation on switches below and in TAB2XML
/DELIM -- See documentation on switches below and in TAB2XML
/USEROOTFORRES -- See documentation on switches below (Since 3.3.3)
XML2TBL[/S] - DEPRECATED. Use XML2TAB
EXAMPLES:
1. Convert a table to XML and show the output on the screen.
nM> convert {SNR=1,FREQ=2} tbl2xml
<XML SNR="1" FREQ="2" />
2. Convert a table with an inner table to XML
nM> convert {INNER={SNR=1,FREQ=2}} tbl2xml
<XML><INNER SNR="1" FREQ="2" /></XML>
3. Convert the table to XML and write the output to a text file
nM> convert {SNR=1,FREQ=2} tbl2xml temp.txt
4. Convert an XML string to a table (no inner tables)
nM> convert "<XML SNR="1" FREQ="2" />" xml2tbl/s tabout
T: TABOUT = Table of 2 entries
1S: SNR = 1
1S: FREQ = 2
5. Convert an XML string to a table (with inner tables)
nM> convert "<XML> <DATA SNR="1" FREQ="2" /> </XML>" xml2tbl/s tabout
T: TABOUT = Table of 1 entries
T: DATA = Table of 2 entries
1S: SNR = 1
1S: FREQ = 2
6. Convert an XML text file to a table
nM> convert temp.xml xml2tbl tabout
7. Convert the following XML text file (test.xml) into a type-3000 file:
<XML>
<PERSDATA>
<LOC NAME="HOMER" SSN="123-45-6789" CITY="SPRINGFIELD" ZIP="12321"/>
<LOC NAME="MARGE" SSN="123-45-6780" CITY="SPRINGFIELD" ZIP="12321"/>
</PERSDATA>
</XML>
nM> convert/xmlkey="xml|persdata" test.xml XML2B tempfile
8. Create a HTML file named "myhtmlfile.html" in the user's write AUX.
nM> CONVERT myNxmTable TBL2HTML myhtmlfile.html
9. Convert the X-Midas template to a NeXtMidas template for use with LIST2.
nM> CONVERT xmtemplate TEMPLATE2TBL mytbl
10. Convert a CSV file into a table skipping the first row and naming the
columns
nM> set qualifiers {HEADERROWS=1,ROWNAME=AIRPORT,&
COLUMNNAMES="NAME|CODE|SF:LAT|SF:LON"}
nM> CONVERT airports.csv^qualifiers csv2tbl tab
11. Convert an XML from a web server to a Table (mytable) with connect timeout
and read timeout of 5 and 30 seconds, respectively.
nM> set urlstr "http://host/file.xml{CONNECTTIMEOUT=5,TIMEOUT=30}"
nM> CONVERT urlstr XML2TAB mytable
12. Convert a subset of data from a Type 5000 StateVector, designated by a
given time offset, to a KML file
nM> CONVERT sv3.prm sv2kml "outfile.kml" OPTIONS={time=3000}
13. Convert (select) Platinum Keywords to BLUE keywords, specifying TOA_SIGMA
and FOA_SIGMA to enable covariance keywords to be converted. Keep the
existing Platinum keywords.
nM> CONVERT testplat4plat2blue_cov.cdif PLAT2BLUE testbluefromplat.tmp &
options={_OPTIONS_={KEEP_EXISTING=true}, &
TOA_SIGMA={VALUE=0.0},FOA_SIGMA={VALUE=0.0}}
13. Convert (select) Platinum Keywords to BLUE Keywords. Since there are no
covariance keyword, SYSTEM_TOA_SIGMA and SYSTEM_FOA_SIGMA should be
specified, but it is not required. Use default of NOT copying over the
Platinum Keywords.
nM> CONVERT testplat4plat2blue.cdif PLAT2BLUE testbluefromplat.tmp
14. Use the general Keyword conversion command KWCONV to convert (select)
Platinum Keywords to BLUE Keywords.
nM> table converttable LOAD kwconv_plat2blue.tbl
nM> CONVERT testplat4plat2blue.cdif KWCONV testbluefromplat.tmp &
options=converttable
SWITCHES:
/BASE= - Indicates if the counter for duplicate tags is ZeroBased
(/BASE=0) or OneBased (/BASE=1). Use -1 to duplicate the
unusual of XML2TBL; use -2 for ZeroBased but with a counter
on every entry (even those without duplicates). [DEF=1]
/CLASSSUB= - Substitute name to use for "class" used with FSTRUCT2JAVA
since "getClass" is reserved in Java. [DEF="Class_"]
/COMP - (TBL2XML,TAB2XML) Turns on character data compression for tags
with ZERO params. [DEF=FALSE]
Compression is off by default to prevent the table structure
from changing if parameters are added to tag.
Without compression:
"<XML><GREETING>Hello</GREETING></XML>"
becomes
{GREETING={CDATA="Hello"}}.
With compression it becomes
{GREETING="Hello"}.
/DEFAULTNAMES - Indicates that file record names of the form TR01 - TR26
be used instead of gleaning the names from the XML field
tags (XML2B and TBL2B only).
/DELIM= - For TBL2B and XML2B: Sets the delimiter character between record
formats [DEF="|"].
For XML2TAB and XML2TBL: Sets the delimiter String used when
indicating duplicate tags.
DEF=["_"] for XML2TAB, DEF=["__"] for XML2TBL
/HTMLKEY= - Main HTML key. TBL2HTML [DEF=HTML]
/INCLUDE= - Comma separated list of #include files to include at the top
of the native JNI code generated by FSTRUCT2JAVA.
/PACKAGE - State switch used with FSTRUCT2JAVA to indicate that the
generated class should be package-private rather than public.
/PARSE - Use parser in T2B option [DEF=FALSE]
/PATH= - Overrides path for MSGCFG2TBL, MSGCFG2INC or MSGCFG2XML. This
should always be quoted. [DEF="^{OPT.PATH}"]
/TL= - Transfer length in elements [EEEI, IEEE and VAX only]
/USEROOTFORRES - (XML2TAB) Overrides OUT= for using the root level element
name for the result name. (Since NeXtMidas 3.3.3)
With /USEROOTFORRES:
"<XML><GREETING>Hello</GREETING></XML>"
will be accessible as
say "^xml"
/VARIABLE= - Name of the static variable to warp for FSTRUCT2JAVA.
If not specified FSTRUCT2JAVA assumes non-static wrapping.
/XMDISK= - Specifies X-Midas installation directory when generating
message configuration for X-Midas using MSGCFG2TBL.
/XMLKEY= - (TBL2XML, XML2TBL) Main XML key. [DEF=XML]
(XML2B) Used to access sub-tables (e.g. "XML|SUBTABLE")
[DEF=XML]
SEE ALSO: FILE nxm.sys.lib.Convert, nxm.sys.lib.Transform