From f9ed7e302535945fc97a1adb18bfcb8a9c6868f0 Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Sun, 3 Sep 2006 11:49:10 +0000 Subject: [PATCH] support the new dataset discoverCountry svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=580381 --- libscience/chemicaldataobject.cpp | 3 +++ libscience/chemicaldataobject.h | 3 ++- libscience/elementparser.cpp | 13 +++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libscience/chemicaldataobject.cpp b/libscience/chemicaldataobject.cpp index edd303f..76f7f3a 100644 --- a/libscience/chemicaldataobject.cpp +++ b/libscience/chemicaldataobject.cpp @@ -233,6 +233,9 @@ QString ChemicalDataObject::dictRef() const case SPhrase: botype ="SPhrase"; break; + case discoveryCountry: + botype ="discoveryCountry"; + break; } botype = botype.prepend( "bo:" ); diff --git a/libscience/chemicaldataobject.h b/libscience/chemicaldataobject.h index fdb9bdd..1e66200 100644 --- a/libscience/chemicaldataobject.h +++ b/libscience/chemicaldataobject.h @@ -84,7 +84,8 @@ class EDUSCIENCE_EXPORT ChemicalDataObject ecDecay/**< The decayenergy of ecminusdecay in MeV */, dangerSymbol/**< the danger symbols are the dangers associated with an element, for example Xn,T+ */, RPhrase/**< */, - SPhrase/**< */ + SPhrase/**< */, + discoveryCountry }; /** diff --git a/libscience/elementparser.cpp b/libscience/elementparser.cpp index eb07bf5..80e06fb 100644 --- a/libscience/elementparser.cpp +++ b/libscience/elementparser.cpp @@ -50,7 +50,8 @@ class ElementSaxParser::Private inDensity( false ), inDangerSymbol( false ), inRPhrase( false ), - inSPhrase( false ) + inSPhrase( false ), + inCountry( false ) { } @@ -87,6 +88,7 @@ class ElementSaxParser::Private bool inDangerSymbol; bool inRPhrase; bool inSPhrase; + bool inCountry; }; ElementSaxParser::ElementSaxParser() @@ -105,7 +107,7 @@ bool ElementSaxParser::startElement(const QString&, const QString &localName, co { d->currentElement = new Element(); d->inElement = true; - } else if (d->inElement && localName == "scalar") + } else if (d->inElement && localName == "scalar" || localName == "array" ) { for (int i = 0; i < attrs.length(); ++i) { @@ -143,6 +145,8 @@ bool ElementSaxParser::startElement(const QString&, const QString &localName, co d->inDiscoveryDate = true; else if (attrs.value(i) == "bo:discoverers") d->inDiscoverers = true; + else if (attrs.value(i) == "bo:discoveryCountry") + d->inCountry = true; else if (attrs.value(i) == "bo:period") d->inPeriod = true; else if (attrs.value(i) == "bo:crystalstructure") @@ -347,6 +351,11 @@ bool ElementSaxParser::characters(const QString &ch) type = ChemicalDataObject::SPhrase; d->inSPhrase = false; } + else if (d->inCountry){ + value = ch; + type = ChemicalDataObject::discoveryCountry; + d->inCountry = false; + } else//it is a non known value. Do not create a wrong object but return return true; -- 2.47.3