From 653dc64720ae78c633c2282519b9b21fb6491b3b Mon Sep 17 00:00:00 2001 From: Hugo Lima Date: Thu, 24 Sep 2009 16:59:56 -0300 Subject: Fix bug#38. --- docparser.cpp | 16 ++++++++++++++-- typesystem.cpp | 7 ++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docparser.cpp b/docparser.cpp index ddff5ffe9..d6e8bf468 100644 --- a/docparser.cpp +++ b/docparser.cpp @@ -95,7 +95,19 @@ QString DocParser::applyDocModifications(const DocModificationList& mods, const if (mods.isEmpty()) return xml; - QString xsl = QLatin1String("\n" + bool hasXPathBasedModification = false; + foreach (DocModification mod, mods) { + if (mod.mode() == DocModification::XPathReplace) { + hasXPathBasedModification = true; + break; + } + } + + if (!hasXPathBasedModification) + return xml; + + QString xsl = QLatin1String("\n" + "\n" "\n" " \n" "\n" @@ -140,7 +152,7 @@ QString DocParser::applyDocModifications(const DocModificationList& mods, const int bufferSize; QString result; if (!xsltSaveResultToString(&buffer, &bufferSize, res.xslResult, res.xslt)) { - result = QByteArray(reinterpret_cast(buffer), bufferSize); + result = QString::fromUtf8(reinterpret_cast(buffer), bufferSize); std::free(buffer); } else { result = xml; diff --git a/typesystem.cpp b/typesystem.cpp index ae5c3a1c8..15166f357 100644 --- a/typesystem.cpp +++ b/typesystem.cpp @@ -777,9 +777,10 @@ bool Handler::startElement(const QString &, const QString &n, const int validParent = StackElement::TypeEntryMask | StackElement::ModifyFunction | StackElement::ModifyField; - if (current->parent && current->parent->type & validParent) - m_docModifications << DocModification(attributes["xpath"], m_currentSignature); - else { + if (current->parent && current->parent->type & validParent) { + QString signature = (current->type & StackElement::TypeEntryMask) ? QString() : m_currentSignature; + m_docModifications << DocModification(attributes["xpath"], signature); + } else { m_error = "modify-documentation must be inside modify-function, " "modify-field or other tags that creates a type"; return false; -- cgit v1.2.3