[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: txt -> xml

Subject: RE: txt -> xml
From: "KIENLE, STEVEN C [IT/0200]" <steven.c.kienle@xxxxxxxxxxxxx>
Date: Mon, 11 Feb 2002 07:34:17 -0600
txt to xml
What is the format of your file?  If it is a simply delimited format, you
could easily create a shell script to split the original file into a simple
compliant XML file.  For example, to use VB-Script:

   Dim FSO
   Dim inputStream
   Dim outputStream
   Dim arrLine
   Dim i

   Set FSO = CreateObject("Scripting.FileSystemObject")
   Set inputStream = FSO.OpenTextFile("c:\temp\input.txt")
   Set outputStream = FSO.CreateTextFile("c:\temp\input.xml", True)

   outputStream.WriteLine "<?xml version=""1.0"" standalone=""yes""?>"
   outputStream.WriteLine "<input>"

   Do While inputStream.AtEndOfStream <> True
       arrLine = Split(inputStream.ReadLine, ",")
       
       outputStream.WriteLine "   <row>"
    
       For i = LBound(arrLine) to UBound(arrLine)
       	outputStream.WriteLine "      <col>" + Trim(arrLine(i)) + "</col>"
       Next
    
       outputStream.WriteLine "   </row>"
   Loop

   outputStream.WriteLine "</input>"

   outputStream.Close
   inputStream.Close

This will create an indented formatted XML file.  If you don't care about
readability, you can even use the Join function to cut some of this code
out.

	Steve

-----Original Message-----
From: Jakub.Valenta@xxxxxxxx [mailto:Jakub.Valenta@xxxxxxxx]
Sent: Monday, February 11, 2002 4:21 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  txt -> xml


Hi all,
I am currently looking for some nice tool which would allow to convert flat
file to xml. Does anyone know about some nice solution.
At the begining I would prefer some charge-free, but if there is non
commercial is good to. The best would be some tool which behave as an
SAX or DOM parser so I could use it to feed the XSLT engine, but it should
posses the capability to specify rules how the txt file should be
interpreted.

Does anyone know how the radix AnyToXML and AnyToAny works, any experiences
with it?

br,

Jakub


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • txt -> xml
    • Jakub . Valenta - Mon, 11 Feb 2002 04:57:16 -0500 (EST)
      • <Possible follow-ups>
      • KIENLE, STEVEN C [IT/0200] - Mon, 11 Feb 2002 08:32:05 -0500 (EST) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.