QDomElement currentElement = m_domDoc.createElement(KVTML_INFORMATION);
writeInformation(currentElement, generator);
domElementKvtml.appendChild(currentElement);
-
+
// identifiers
currentElement = m_domDoc.createElement(KVTML_IDENTIFIERS);
writeIdentifiers(currentElement);
domElementKvtml.appendChild(currentElement);
-
+
// types
currentElement = m_domDoc.createElement(KVTML_TYPES);
writeTypes(currentElement);
{
domElementKvtml.appendChild(currentElement);
}
-
+
// tenses
currentElement = m_domDoc.createElement(KVTML_TENSES);
writeTenses(currentElement);
{
domElementKvtml.appendChild(currentElement);
}
-
+
// usages
currentElement = m_domDoc.createElement(KVTML_USAGES);
writeUsages(currentElement);
{
domElementKvtml.appendChild(currentElement);
}
-
+
// entries
currentElement = m_domDoc.createElement(KVTML_ENTRIES);
if (!writeEntries(currentElement))
return false;
}
domElementKvtml.appendChild(currentElement);
-
+
// lessons
currentElement = m_domDoc.createElement(KVTML_LESSONS);
writeLessons(currentElement);
{
domElementKvtml.appendChild(currentElement);
}
-
+
//** NOTE: everything below this point has not been updated to use kvtml2 format****
//if (!writeLesson(m_domDoc, domElementKvtml))
// return false;
{
QDomElement currentElement;
QDomText textNode;
-
+
// generator
informationElement.appendChild(newTextElement(KVTML_GENERATOR, generator));
-
+
// title
if (!m_doc->title().isEmpty())
{
{
informationElement.appendChild(newTextElement(KVTML_COMMENT, m_doc->documentRemark()));
}
-
+
return true;
}
{
// create the node
QDomElement identifier = m_domDoc.createElement(KVTML_IDENTIFIER);
-
+
// set the id
identifier.setAttribute(KVTML_ID, QString::number(i));
-
- // record the identifier as the locale for now
+
+ // record the identifier as the locale for now
// TODO: when support for more parts of the identifier is in the document class (name, type, etc.) store those here as well
identifier.appendChild(newTextElement(KVTML_LOCALE, m_doc->identifier(i)));
-
+
// record articles
QDomElement article = m_domDoc.createElement(KVTML_ARTICLE);
writeArticle(article, i);
{
identifier.appendChild(article);
}
-
+
// record personalpronouns
QDomElement personalpronouns = m_domDoc.createElement(KVTML_PERSONALPRONOUNS);
writeConjugation(personalpronouns, m_doc->conjugation(i), QString());
{
identifier.appendChild(personalpronouns);
}
-
+
// add this identifier to the group
identifiersElement.appendChild(identifier);
}
return true;
QMap<int, KEduVocLesson*> lessons = m_doc->lessons();
-
+
foreach(int lessonid, lessons.keys())
{
KEduVocLesson * thisLesson = lessons[lessonid];
// add a name
thisLessonElement.appendChild(newTextElement(KVTML_NAME, thisLesson->description()));
-
+
// add a inquery tag
thisLessonElement.appendChild(newTextElement(KVTML_QUERY, m_doc->lessonInQuery(lessonid) ? KVTML_TRUE : KVTML_FALSE));
-
+
// add a current tag
thisLessonElement.appendChild(newTextElement(KVTML_CURRENT, m_doc->currentLesson() == lessonid ? KVTML_TRUE : KVTML_FALSE));
-
+
// TODO: add the entryids...
for (int i = 0; i < m_doc->entryCount(); ++i)
{
thisLessonElement.appendChild(newTextElement(KVTML_ENTRYID, QString::number(i)));
}
}
-
+
lessonsElement.appendChild(thisLessonElement);
}
QDomElement indefinite = m_domDoc.createElement(KVTML_INDEFINITE);
QString def;
QString indef;
-
+
// male
m_doc->article(article).getMale(&def, &indef);
if (!def.isEmpty())
{
indefinite.appendChild(newTextElement(KVTML_MALE, indef));
}
-
+
// female
m_doc->article(article).getFemale(&def, &indef);
if (!def.isEmpty())
{
indefinite.appendChild(newTextElement(KVTML_FEMALE, indef));
}
-
+
// neutral
m_doc->article(article).getNatural(&def, &indef);
if (!def.isEmpty())
{
articleElement.appendChild(definite);
}
-
+
if (indefinite.hasChildNodes())
{
articleElement.appendChild(indefinite);
{
foreach(QString tense, m_doc->tenseDescriptions())
{
- if (!(tense.isNull()))
+ if (!(tense.isNull()))
{
tensesElement.appendChild(newTextElement(KVTML_TENSE, tense));
}
for (int i = 0; i < m_doc->entryCount(); ++i)
{
KEduVocExpression *thisEntry = m_doc->entry(i);
-
+
// write entry tag
QDomElement entryElement = m_domDoc.createElement(KVTML_ENTRY);
// write inactive
entryElement.appendChild(newTextElement(KVTML_INACTIVE, thisEntry->isActive() ? KVTML_FALSE : KVTML_TRUE));
-
+
// write inquery
entryElement.appendChild(newTextElement(KVTML_INQUERY, thisEntry->isInQuery() ? KVTML_TRUE : KVTML_FALSE));
-
+
// write sizehint
if (thisEntry->sizeHint() > 0)
{
{
// <text>Kniebeugen</text>
translationElement.appendChild(newTextElement(KVTML_TEXT, translation.translation()));
-
+
// <type></type>
if (!translation.type().isEmpty())
{
translationElement.appendChild(newTextElement(KVTML_TYPE, translation.type()));
}
-
+
// <comment></comment>
if (!translation.comment().isEmpty())
{
{
translationElement.appendChild(newTextElement(KVTML_PRONUNCIATION, translation.pronunciation()));
}
-
+
// <falsefriend fromid="0"></falsefriend>
// loop through the identifiers
for (int i = 0; i < m_doc->identifierCount(); ++i)
{
translationElement.appendChild(newTextElement(KVTML_ANTONYM, translation.antonym()));
}
-
+
// <synonym></synonym>
if (!translation.synonym().isEmpty())
{
translationElement.appendChild(newTextElement(KVTML_SYNONYM, translation.synonym()));
}
-
+
// <example></example>
if (!translation.example().isEmpty())
{
translationElement.appendChild(newTextElement(KVTML_EXAMPLE, translation.example()));
}
-
+
// <usage></usage>
if (!translation.usageLabel().isEmpty())
{
translationElement.appendChild(newTextElement(KVTML_USAGE, translation.usageLabel()));
}
-
+
// <paraphrase></paraphrase>
if (!translation.paraphrase().isEmpty())
{
- translationElement.appendChild(newTextElement(KVTML_USAGE, translation.paraphrase()));
+ translationElement.appendChild(newTextElement(KVTML_PARAPHRASE, translation.paraphrase()));
}
-
+
// grades
for (int i = 0; i < m_doc->identifierCount(); ++i)
{
//<date>949757271</date>
gradeElement.appendChild(newTextElement(KVTML_DATE, QString::number(thisGrade.queryDate().toTime_t())));
-
+
translationElement.appendChild(gradeElement);
}
}
-
+
// conjugation
if (!translation.conjugation().entryCount() > 0)
{
translationElement.appendChild(thisElement);
}
}
-
+
// comparison
if (!translation.comparison().isEmpty())
{
writeComparison(comparisonElement, translation.comparison());
translationElement.appendChild(comparisonElement);
}
-
+
// multiplechoice
if (!translation.multipleChoice().isEmpty())
{
writeMultipleChoice(multipleChoiceElement, translation.multipleChoice());
translationElement.appendChild(multipleChoiceElement);
}
-
+
// image
// sound
return true;
}
-bool KEduVocKvtml2Writer::writeConjugation(QDomElement &conjugationElement,
+bool KEduVocKvtml2Writer::writeConjugation(QDomElement &conjugationElement,
const KEduVocConjugation &conjugation, const QString &type)
{
// first singular conjugations
QString third_male = conjugation.pers3MaleSingular(type);
QString third_female = conjugation.pers3FemaleSingular(type);
QString third_neutral = conjugation.pers3NaturalSingular(type);
-
+
if (!first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() ||
!third_male.isEmpty() || !third_neutral.isEmpty())
{
QDomElement singular = m_domDoc.createElement(KVTML_SINGULAR);
-
+
singular.appendChild(newTextElement(KVTML_1STPERSON, first));
singular.appendChild(newTextElement(KVTML_2NDPERSON, second));
-
+
if (third_common)
{
singular.appendChild(newTextElement(KVTML_COMMON, third_female));
}
conjugationElement.appendChild(singular);
}
-
+
// now for plurals
first = conjugation.pers1Plural(type);
second = conjugation.pers2Plural(type);
third_male = conjugation.pers3MalePlural(type);
third_female = conjugation.pers3FemalePlural(type);
third_neutral = conjugation.pers3NaturalPlural(type);
-
+
if (!first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() ||
!third_male.isEmpty() || !third_neutral.isEmpty())
{
QDomElement plural = m_domDoc.createElement(KVTML_PLURAL);
-
+
plural.appendChild(newTextElement(KVTML_1STPERSON, first));
plural.appendChild(newTextElement(KVTML_2NDPERSON, second));
-
+
if (third_common)
{
plural.appendChild(newTextElement(KVTML_COMMON, third_female));