[calligra] /: Add api for writing ODF that is generated from the ODF RNG file.
Friedrich W. H. Kossebau
kossebau at kde.org
Sun Aug 4 19:25:19 BST 2013
Hi,
really cool work from Jos, happy to see it having made it into Calligra master
:)
Am Sonntag, 4. August 2013, 17:41:20 schrieb Jos van den Oever:
> Example:
> Instead of writing:
> ==
> xmlWriter->startElement("text:p");
> xmlWriter->addAttribute("text:style-name", "italic");
> xmlWriter->startElement("text:p");
> xmlWriter->addAttribute("text:style-name", "bold");
> xmlWriter->addTextNode("Hello World!");
> xmlWriter->endElement();
> xmlWriter->endElement();
> ==
> you can write:
> ==
> text_p p(xmlWriter);
> p.set_text_style_name("italic");
> text_span span(p.add_text_span());
> span.set_text_style_name("italic");
> span.addTextNode("Hello World!");
> ==
Having finally given the patch I look as well I found I have a really hard
time reading all_the_created_methods_and_objects.
I wonder who else would favour to do like it is done in the browsers' HTML
DOM, where the hyphens in all element/attribute names are replaced by removing
them and turning the following letter to Uppercase.
Might need some more work in the generator, but given that this is affecting
quite some code is should be worth the effort. So the only usages of _ would
be to separate the element/attribute name from e.g. the set-prefix and as
replacement for the namespace separator, which at least might help parsing. So
in the given example it would be:
> text_p p(xmlWriter);
> p.set_text_styleName("italic");
> text_span span(p.add_text_span());
> span.set_text_styleName("italic");
> span.addTextNode("Hello World!");
What do people think? What are other downsides of this approach? Will it need
some special case handling for some cases (and would that still be worth it??
Cheers
Friedrich
More information about the calligra-devel
mailing list