Review Request 109393: a new library for traversing odf files and a new export filter
Inge Wallin
inge at lysator.liu.se
Fri Mar 22 19:25:05 GMT 2013
On March 20, 2013, 9:17 p.m., Inge Wallin wrote:
> > Interesting approach to the common case of writing an export filter. I have a few comments and ideas on the problem and the approach.
> >
> > Usually one would use XSLT to convert one xml format to another. However in ODF, there is a lot of context which is not easily available.
> > Nevertheless, in XSLT one has the e.g. XPath expression
> > "document('styles.xml')//styles:styles" to list all the styles
> > or
> > "document('styles.xml')//manifest:file-entry" to list all files from the manifest
> >
> > Getting image sizes is tricky though. They'd need to be put in a temporary xml file which is available to the xslt.
> >
> >
> > If you go with the C++ approach, you could try to be complete. Currently, the list of available tags is whatever you think is useful and should be expanded whenever you want to support more. Another approach could be to parse the relax ng and generate the code like explained in
> > http://lists.kde.org/?l=calligra-devel&m=130768698325584
> >
> >
> > As it currently stands, the TraversalBackend not that much information is added on top of
> > QXmlContentHandler::startElement / QXmlContentHandler::endElement
> > except a switch for the various QNames. But you do lose the speed of a SAX parser by using KoXmlElement.
> >
> >
> >
> >
> >
> >
> >
We already talked on IRC but I thought I'd add my comments here as well.
Regarding stream reading (QXmlStreamReader instead of KoXmlReader): I'm positive to that but it has to be a later optimization.
Regarding automatic code generation: I'm positive to that too but that's not a small task.
So overall good ideas but all of them for later.
- Inge
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/109393/#review29595
-----------------------------------------------------------
On March 20, 2013, 8:35 p.m., Inge Wallin wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/109393/
> -----------------------------------------------------------
>
> (Updated March 20, 2013, 8:35 p.m.)
>
>
> Review request for Calligra.
>
>
> Description
> -------
>
> This patch creates a new library in filters/odftraverse. The purpose of this library is to create classes to make it easier to create export filters for ODF files. What you do to use this library is that you inherit a base class for backends to this parser / traverser and in the many callbacks you write the output that is relevant for your output format.
>
> To show how it can be used I have also created a very simple proof of concept filter that exports to text format, something Calligra actually lacked before.
>
> The current implementation traverses only ODT files and there are still a number of NYI functions that I want to finish before the actual merge. But I thought I'd get some opinions early. In other words, I expect at least one, maybe two iterations before this branch can be merged.
>
>
> Diffs
> -----
>
> filters/CMakeLists.txt bb0db3d
> filters/libodftraverse/CMakeLists.txt PRE-CREATION
> filters/libodftraverse/OdfParser.h PRE-CREATION
> filters/libodftraverse/OdfParser.cpp PRE-CREATION
> filters/libodftraverse/OdfTraverserContext.h PRE-CREATION
> filters/libodftraverse/OdfTraverserContext.cpp PRE-CREATION
> filters/libodftraverse/OdtTraverser.h PRE-CREATION
> filters/libodftraverse/OdtTraverser.cpp PRE-CREATION
> filters/libodftraverse/OdtTraverserBackend.h PRE-CREATION
> filters/libodftraverse/OdtTraverserBackend.cpp PRE-CREATION
> filters/libodftraverse/odftraverse_export.h PRE-CREATION
> filters/words/ascii/AsciiExport.h PRE-CREATION
> filters/words/ascii/AsciiExport.cpp PRE-CREATION
> filters/words/ascii/CMakeLists.txt d36de47
> filters/words/ascii/OdtTraverserAsciiBackend.h PRE-CREATION
> filters/words/ascii/OdtTraverserAsciiBackend.cpp PRE-CREATION
> filters/words/ascii/TODO ceb1a24
> filters/words/ascii/words_ascii_export.desktop PRE-CREATION
>
> Diff: http://git.reviewboard.kde.org/r/109393/diff/
>
>
> Testing
> -------
>
> Tested with a lengthy text file.
>
>
> Thanks,
>
> Inge Wallin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20130322/a92c44a4/attachment.htm>
More information about the calligra-devel
mailing list