From: Jeremy Paul Whiting Date: Mon, 30 Jul 2007 02:08:12 +0000 (+0000) Subject: only write non-empty articles in identifiers X-Git-Tag: v3.93.0~111 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=8e4bdf6fc5e3d93e153e7e897970e9196880d3de;p=libqmvoc.git only write non-empty articles in identifiers svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=694093 --- diff --git a/kdeeducore/keduvockvtml2writer.cpp b/kdeeducore/keduvockvtml2writer.cpp index 5ee7bb4..f0762b0 100644 --- a/kdeeducore/keduvockvtml2writer.cpp +++ b/kdeeducore/keduvockvtml2writer.cpp @@ -447,21 +447,46 @@ bool KEduVocKvtml2Writer::writeArticle(QDomElement &articleElement, int article) // male m_doc->article(article).getMale(&def, &indef); - definite.appendChild(newTextElement(KVTML_MALE, def)); - indefinite.appendChild(newTextElement(KVTML_MALE, indef)); + if (!def.isEmpty()) + { + definite.appendChild(newTextElement(KVTML_MALE, def)); + } + if (!indef.isEmpty()) + { + indefinite.appendChild(newTextElement(KVTML_MALE, indef)); + } // female m_doc->article(article).getFemale(&def, &indef); - definite.appendChild(newTextElement(KVTML_FEMALE, def)); - indefinite.appendChild(newTextElement(KVTML_FEMALE, indef)); + if (!def.isEmpty()) + { + definite.appendChild(newTextElement(KVTML_FEMALE, def)); + } + if (!indef.isEmpty()) + { + indefinite.appendChild(newTextElement(KVTML_FEMALE, indef)); + } // neutral m_doc->article(article).getNatural(&def, &indef); - definite.appendChild(newTextElement(KVTML_NEUTRAL, def)); - indefinite.appendChild(newTextElement(KVTML_NEUTRAL, indef)); + if (!def.isEmpty()) + { + definite.appendChild(newTextElement(KVTML_NEUTRAL, def)); + } + if (!indef.isEmpty()) + { + indefinite.appendChild(newTextElement(KVTML_NEUTRAL, indef)); + } - articleElement.appendChild(definite); - articleElement.appendChild(indefinite); + if (definite.hasChildNodes()) + { + articleElement.appendChild(definite); + } + + if (indefinite.hasChildNodes()) + { + articleElement.appendChild(indefinite); + } return true; }