]> Git trees. - libqmvoc.git/commitdiff
only write non-empty articles in identifiers
authorJeremy Paul Whiting <jpwhiting@kde.org>
Mon, 30 Jul 2007 02:08:12 +0000 (02:08 +0000)
committerJeremy Paul Whiting <jpwhiting@kde.org>
Mon, 30 Jul 2007 02:08:12 +0000 (02:08 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=694093

kdeeducore/keduvockvtml2writer.cpp

index 5ee7bb4046df967cb1533e1e29a0b43897a2bd63..f0762b058da5a90044abe13623c5c67edf64fa07 100644 (file)
@@ -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;
 }