<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/109887/">http://git.reviewboard.kde.org/r/109887/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#e0e0e0" width="100%" cellpadding="8" style="border: 1px gray solid;">
<tr>
<td>
<h1 style="margin-right: 0.2em; padding: 0; font-size: 10pt;">This change has been marked as submitted.</h1>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Calligra, Jarosław Staniek and Jos van den Oever.</div>
<div>By Inge Wallin.</div>
<p style="color: grey;"><i>Updated July 26, 2013, 7:16 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This patch contains a new XML stream reader based on the QXmlStreamReader that is better suited for ODF.
Much ODF parsing code in Calligra looks like:
if (el.namespaceUri() == KoXml::fo && el.name == "border") { ... }
The reason for this complicated construction is that the prefix (the "fo" in "fo:border") is not unique but is declared at the beginning of each Xml file. Even though "fo" is the normal prefix there is no guarantee that it is the same in every document.
However, it is a very rare document where it is *not* the normal prefix, so what we want to do is to be able to write code like this:
If (el.qualifiedName() == "fo:border") { ... }
and make the XML stream reader or dom tree rewrite the qualified name in the very rare cases that the prefix does not match what we want.
This is exactly what the KoXmlStreamReader does. It allows you to write easier and faster code while still be correct in the few cases where the prefixes are not the expected ones. It does this by letting the user enter the expected namespace declarations and then compare those to the actual namespace declarations in the document. If they match everything will be as fast as possible. If they don't, it will be slower but still correct.
As an extra feature I have allowed the user to declare some extra namespaces (see fixNamespace() in KoXmlReader.cpp). This will let documents created by old versions of OpenOffice.org be read even though they use other namespaces.
I have code that uses this file but that is not yet ready for review. I wanted to put this up early to get feedback while the rest of the yet unfinished code is maturing.
</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Not much. I will do that when the code that uses this code is ready. This review is for getting feedback on the ideas and implementation details.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>libs/odf/CMakeLists.txt <span style="color: grey">(3680486)</span></li>
<li>libs/odf/KoXmlStreamReader.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>libs/odf/KoXmlStreamReader.cpp <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/109887/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>