Altova Mailing List Archives
>comp.text.xml Archive Home
>Thread Prev - convert text documents to XML
Re: convert text documents to XML
Date: 8/4/2009 4:31:00 AM
> can we convert it into xml directly? You could certainly write code to parse this document format and produce XML output. Of course, you have to decide what XML markup you're going to use to represent the data, but after doing that it's not significantly harder to produce XML than to put the data into a database. I would recommend taking advantage of existing XML APIs -- DOM or SAX -- which will take care of the details of XML syntax and let you focus on the structure of the XML document. DOM is probably easier for a beginner to learn, since it's a tree structure; SAX is event-based and requires that you maintain more state in your own code, but would be more efficient for this sort of flow-through format conversion. There may be off-the-shelf tools which can do the conversion for you, but I haven't used any... and I'd consider this a fairly trivial bit of programming so I wouldn't bother looking for one. You might also want to contact whoever maintains the database you're trying to access via the web, and see if they already offer a service which returns the data in XML form rather than text form.