cvs To XML using XSD

Hi folks,

I am not sure whether this thread has been answered, but I am looking for ways to create an XML object from a CSV input stream/file where the format may change in the future. I would like to use an XSD to do the mapping. Is it possible? If so what is required? If not possible, what is the next best thing.

Thanks in advance.

-r

[363 byte] By [rhajikhani1a] at [2007-10-2 18:52:45]
# 1

XSLT is a thingie that transforms XML. It can transform XML into something that is not XML, but it cannot transform something that is not XML into anything.

The only XML-ish thing I've seen done with non-XML contents was described by Michael Kay in his XML book, published by Wrox. It is possible to read a well-formed (meaning that you have some prior knowledge of the format, and how it would look if it were only XML) file, and call a SAX ContentHandler as if you were a parser. You call the startDocument method, then you figure out what element comes next, and call the startElement, the characters, and endElement methods for that content. As far as the ContentHandler is concerned, it thinks it is getting good SAX content, and it is. The difference is that it is not coming from a SAX parser.

The example given in the referenced book is reading a GEDCOM file. That is a structured text version of genealogical data. It has records for families, marriages, children, etc. It is no at all an XML source.

I hope this helps.

Dave Patterson

d.pattersona at 2007-7-13 20:15:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Exactly. And you can find another example in ERH's online book here: http://www.cafeconleche.org/books/xmljava/chapters/ch08s05.html
DrClapa at 2007-7-13 20:15:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...