On Thu, 18 Apr 2002 15:46, Carsten Ziegeler wrote: > Peter Donald wrote: > > <snip/> > > > > 2 options here. > > > > [1] We add an extra component to do conversion of stream to xml > > (I assume this > > is for converting things like excel into XML??? or .psd files to > > svga??). So > > what I would do in this case is then add a "getMimeType()" to the Source > > interface that returns a string about what type the underlying file. Then > > have another set of components that convert objects of different > > mimetypes to > > xml streams. > > > > This is the same architecture as used in the Java URL system ie they have > > stream handlers (which are like Source objects) and > > ContentHandlers (which > > are like converters between stream and object type). > > Hi Peter, > > believe me or not, but I thought about this problem the whole night > and finally came to the same conclusion as you propose above
woohoo! Hate when that happens though ;) > So, my proposol is to add a getMimeType() method to the Source interface > and an "XMLizer" component to the xml package. This XMLizer gets > a mime-type and an input stream as input and creates sax events from this. > This will > - decouple the source and the xml package totally > - the XMLizer is not only usable for source objects > - the XMLizer is extensible... fantastic. This brings up another idea I have been playing with recently. I have a couple of binary file formats that I convert into SAX events for further processing... Maybe it would be an idea to instead create a new package for XMLizer interface and related implementations. ie I assume that there is a POI deserializer (or whatever they are called in cocoon) that reads the excel/word/whatever documents and produces an XML stream (either as SAX or as DOM). I have similar readers that deal with other binary protocols. I also used to always use a directory to XML producer (I stole idea from stylebook IIRC). I am sure other people have other similar demands. (PDF to XML?) So maybe a generic framework for converting streams to XML may be in order ? Something separate from XML parsing stuff already in place? > I hope to make a first version of my proposal today, so there > should be no time problem. excellent. Look forward to it ;) -- Cheers, Peter Donald -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
