Review Request 109393: a new library for traversing odf files and a new export filter

Jos van den Oever jos at vandenoever.info
Wed Mar 20 21:17:18 GMT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/109393/#review29595
-----------------------------------------------------------



filters/libodftraverse/OdfTraverserContext.h
<http://git.reviewboard.kde.org/r/109393/#comment22081>

    Is the name e.g. dc:title or the full QName
    
      {http://purl.org/dc/elements/1.1/}title
    
    You could use QPair<QString,QString> as key. Unfortunately Qt has no class like
     http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/namespace/QName.html



filters/libodftraverse/OdfTraverserContext.h
<http://git.reviewboard.kde.org/r/109393/#comment22080>

    Is a file listed here guaranteed to be here or are you simple returning
    
    manifest:file-entry/@manifest:full-path
    and
    manifest:file-entry/@manifest:media-type
    ?



filters/libodftraverse/OdfTraverserContext.h
<http://git.reviewboard.kde.org/r/109393/#comment22079>

    How do you determine size for svg files?
    


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.








- Jos van den Oever


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/20130320/096de4ea/attachment.htm>


More information about the calligra-devel mailing list