txt2xt

Section: User Commands (1)
Updated: 2002-10-26
Index Return to Main Contents

 

NAME

txt2xt - Convert plainText to XML Table

 

SYNOPSIS

txt2xt -F [-a attribute(s)] [-l title] [-c comment] [-I import filename] [-i INPUT] [-o OUTPUT] [-z]

 

DESCRIPTION

This command converts a plainText file to an xmlTable file. The three methods to specify attribute names are options -F, -a and -I. When all of -F,-a and -I are specified, the priority is given in the order of -I, -F, -a. When header is imported with -I, all header information such as sort status is imported.

 

PARAMETERS

-a list of attributes
Record the list of attributes specified here in the header of xmlTable

-l title
Record the title specified here in the header of xmlTable

-c comment
Record the comment specified here in the header of xmlTable

-I import filename
Import header from the other xmlTable file

-F
Treats the first line of plainText file as attribute names: regard the first line of plainText file as attribute names.

 

FILE OPTIONS

-i input filename
If a suffix of the filename is '.gz', the command acts as a filter, extracting the compressed file for processing. The command will read the file as standard input when "-i" is not specified.
-o output filename
If a suffix of the filename is '.gz', the command automatically returns the output data in zip archive. When "-o" is not specified, the result will sent to standard output.
-z
compress the standard output to zip archive. When the option "-o" is not given and "-z" is specified, the output will be compressed as zip archive.

 

USAGE

Input file - dat.txt:
CustomerID     BirthDate       Gender

A00001         19610615        F

A00002         19571029        F

A00003         19790608        F

A00004         19530110        F

A00005         19790712        F

A00006         19570421        M

1. Convert plainText data with attributes in the first row to XML table.

e.g. txt2xt -F -i dat.txt -o rsl.xt

Output file - rsl.xt:


<?xml version="1.0" encoding="euc-jp"?>
<xmltbl version="1.00">
<header>
<field no="1">
<name>CustomerID</name>
</field>
<field no="2">
<name>BirthDate</name>
</field>
<field no="3">
<name>Gender</name>
</field>
<recCnt>0</recCnt>
</header>
<body><![CDATA[
A00001 19610615 F
A00002 19571029 F
A00003 19790608 F
A00004 19530110 F
A00005 19790712 F
A00006 19570421 M

2. Convert the file dat.txt to XML table, and define the attributes - customerID, birthdate, and Gender with -a.

e.g. txt2xt -a CustomerID,BirthDate,Gender -i dat.txt -o rls.xt

Output file -rsl.xt:


<?xml version="1.0" encoding="euc-jp"?>
<xmltbl version="1.00">
<header>
<field no="1">
<name>CustomerID</name>
</field>
<field no="2">
<name>BirthDate</name>
</field>
<field no="3">
<name>Gender</name>
</field>
<recCnt>0</recCnt>
</header>
<body><![CDATA[
CustomerID BirthDate Gender
A00001 19610615 F
A00002 19571029 F
A00003 19790608 F
A00004 19530110 F
A00005 19790712 F
A00006 19570421 M

3. Specify the title and comment with -l and -c respectively.

e.g. txt2xt -F -i dat.txt -l "sample data" -c "created for manual use" -o rsl.xt

Output file - rsl.xt:


<?xml version="1.0" encoding="euc-jp"?>
<xmltbl version="1.00">
<header>
<title>
sample data
</title>
<comment>
created for manual use
</comment>
<field no="1">
<name>CustomerID</name>
</field>
<field no="2">
<name>BirthDate</name>
</field>
<field no="3">
<name>Gender</name>
</field>
<recCnt>0</recCnt>
</header>
<body><![CDATA[
A00001 19610615 F
A00002 19571029 F
A00003 19790608 F

4. Import header from header.xt file for dat.txt and convert dat.xt to XML table.

e.g. txt2xt -I header.xt -i dat.txt -o rsl.xt

Header file - header.xt:
<?xml version="1.0" encoding="euc-jp"?>
<xmltbl version="1.00">
<header>
<title>
New title - sample data
</title>
<comment>
New comment - created for manual use
</comment>
<field no="1">
<name>Customer</name>
</field>

Output file - rsl.xt:


<?xml version="1.0" encoding="euc-jp"?>
<xmltbl version="1.00">
<header>
<title>
New title - sample data
</title>
<comment>
New comment - created for manual use
</comment>
<field no="1">
<name>Customer</name>
</field>
<field no="2">
<name>BirthDate</name>
</field>
<field no="3">
<name>Gender</name>
</field>
</header>

 

SEE ALSO

xt2txt(1), xt2xml(1), xml2xt(1) For complete documentation and tutorial of txt2xt and other commands, please visit http://musashien.sourceforge.net

 

BUG REPORT

If you find a bug in txt2xt, please send electronic mail to musashi@adm.osaka-sandai.ac.jp. Before sending a bug report, please verify that you have the lastest version of MUSASHI. Read this manual carefully to ensure the error is not caused by a quirk in the language.  

AUTHORS

Yukinobu Hamuro, Naoki Katoh, Katsutoshi Yada, Stephane Cheung


 

Index

NAME
SYNOPSIS
DESCRIPTION
PARAMETERS
FILE OPTIONS
USAGE
SEE ALSO
BUG REPORT
AUTHORS

This document was created by man2html, using the manual pages.
Time: 22:43:51 GMT, June 24, 2003