[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: txt -> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|