Commit 6f4066e8 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix loading in Krita. The problem was in KoXmlReader, where a feature

string had changed from trolltech to qtsoftware... Took me a fair bit
of work to figure that out! And weirdly enough, KoXmlNode.isElement()
still doesn't work, but trying to make it into an element does work.

svn path=/trunk/koffice/; revision=924836
parent 2d95bb94
......@@ -222,12 +222,11 @@ KisNode* KisKraLoader::loadNodes(const KoXmlElement& element, KisImageSP img, Ki
KoXmlNode node = element.lastChild();
KoXmlNode child;
if ( !node.isNull() ) {
qDebug() << ">>>>>>>>>>> " << node.isElement() << ", " << node.nodeName() << ", " << node.toText().data();
if ( node.isElement() ) {
if ( !node.toElement().isNull() ) {
qDebug() << ">>>>>>>>>>>>> " << node.nodeName();
if ( node.nodeName().toUpper() == LAYERS.toUpper() || node.nodeName().toUpper() == MASKS.toUpper() ) {
for ( child = node.lastChild(); !child.isNull(); child = child.previousSibling() ) {
KisNode* node = loadNode( child.toElement(), img );
......
......@@ -86,6 +86,10 @@
#include <QStringList>
#include <QVector>
#include <kdeversion.h>
/*
Use more compact representation of in-memory nodes.
......@@ -722,7 +726,7 @@ public:
addCData, addProcessing are all related. These are all necessary
for stateful manipulation of the document. See also the calls
to these function from KoXmlHandler.
The state itself is defined by the member variables
currentDepth and the groups (see above).
*/
......@@ -1472,8 +1476,11 @@ bool KoXmlNodeData::setContent(QXmlInputSource* source, bool namespaceProcessing
QXmlSimpleReader reader;
reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), namespaceProcessing);
reader.setFeature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"), !namespaceProcessing);
#if QT_VERSION < 0x040500
reader.setFeature(QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData"), false);
#else
reader.setFeature(QLatin1String("http://qtsoftware.com/xml/features/report-whitespace-only-CharData"), false);
#endif
return setContent(source, &reader, errorMsg, errorLine, errorColumn);
}
......@@ -2598,7 +2605,11 @@ bool KoXmlDocument::setContent(QIODevice* device, bool namespaceProcessing,
QXmlSimpleReader reader;
reader.setFeature("http://xml.org/sax/features/namespaces", namespaceProcessing);
reader.setFeature("http://xml.org/sax/features/namespace-prefixes", !namespaceProcessing);
reader.setFeature("http://trolltech.com/xml/features/report-whitespace-only-CharData", false);
#if QT_VERSION < 0x040500
reader.setFeature(QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData"), false);
#else
reader.setFeature(QLatin1String("http://qtsoftware.com/xml/features/report-whitespace-only-CharData"), false);
#endif
// FIXME this hack is apparently private
//reader.setUndefEntityInAttrHack(true);
......@@ -2841,7 +2852,11 @@ bool KoXml::setDocument(KoXmlDocument& doc, QIODevice* device,
QXmlSimpleReader reader;
reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), namespaceProcessing);
reader.setFeature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"), !namespaceProcessing);
#if QT_VERSION < 0x040500
reader.setFeature(QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData"), false);
#else
reader.setFeature(QLatin1String("http://qtsoftware.com/xml/features/report-whitespace-only-CharData"), false);
#endif
KoXmlInputSource* source = new KoXmlInputSource(device);
bool result = doc.setContent(source, &reader, errorMsg, errorLine, errorColumn);
......
......@@ -46,7 +46,7 @@ class QString;
class QXmlReader;
class QXmlInputSource;
#include "KoXmlReaderForward.h"
class KoXmlNode;
class KoXmlText;
class KoXmlCDATASection;
class KoXmlDocumentType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment