RE: [xsl] txt -> xml

Subject: RE: [xsl] txt -> xml
From: "KIENLE, STEVEN C [IT/0200]" <steven.c.kienle@xxxxxxxxxxxxx>
Date: Mon, 11 Feb 2002 07:34:17 -0600
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: [xsl] 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
  • [xsl] txt -> xml
    • Jakub . Valenta - Mon, 11 Feb 2002 11:20:58 +0200
      • <Possible follow-ups>
      • KIENLE, STEVEN C [IT/0200] - Mon, 11 Feb 2002 07:34:17 -0600 <=