Re: [xsl] Open Source - Excel to XML Converter

Subject: Re: [xsl] Open Source - Excel to XML Converter
From: Andrew Franz <afranz0@xxxxxxxxxxxxxxxx>
Date: Thu, 05 Oct 2006 07:33:32 +1000
Sorry, I missed the subject line.
We can fix that ;-)

Visual basic class to write to a text file, name this clXFile:
<code><![*CDATA*[
Private fno As Integer
Private eno As Long

Function xOpen(fs As String)
   fno = FreeFile(0)
   Open fs For Output As #fno
   eno = Err.Number
   xOpen = eno
End Function
Property Let xRec(val As String)
       Print #fno, val
End Property
Property Get ErrorNo() As Long
   ErrorNo = eno
End Property

Sub xClose()
   Close fno
   fno = 0
End Sub
]]></code>

Usage:
<code><![*CDATA*[
...
   Dim er As Long
   Dim ux As New clXFile
   er = ux.xOpenOut(fname)
   er = ux.xOpenOut(fname)
   If (er = 0) Then
       ux.xRec() = "<root>"
       ux.xRec() = "<row>...</row>"
      ....
       Call ux.xClose
   End If
]]></code>


Bryce K. Nielsen wrote:


Not very OpenSource, like the OP requested ;-)

There are actually many tools that can do this, and even XSLT 2.0 can read in a text document to transform into XML. I believe there are a bunch of tutorials online explaining how to do this, though don't know of any off hand that can. xmlLinguist (at http://www.sysonyx.com/products/xmllinguist) is a tool I work with that can translate a structured text document (i.e. a *.CSV) into XML if you don't want to go through XSL. It can be a cost effective solution at $80 for the designer, free for the runtime engine. Designed more for EDI documents, it can do CSVs easily enough.

Bryce K. Nielsen
SysOnyx, Inc. (www.sysonyx.com)
Makers of xmlDig, the XML-SQL Extractor
http://www.sysonyx.com/products/xmldig


Visual Basic

Rashmi Rubdi wrote:

It's a bit tedious to create this file manually and
was looking to enter the data in an Excel spread sheet
and then use a converter to convert from Excel to XML.

Does any one know a good converter?

Current Thread