########### next target ###############
-set(isotopereadingtest_SRCS isotopereadingtest.cpp )
+#set(isotopereadingtest_SRCS isotopereadingtest.cpp )
-kde4_automoc(${isotopereadingtest_SRCS})
+#kde4_automoc(${isotopereadingtest_SRCS})
-if(KDE4_BUILD_TESTS)
+#if(KDE4_BUILD_TESTS)
-kde4_add_executable(isotopereadingtest ${isotopereadingtest_SRCS})
+#kde4_add_executable(isotopereadingtest ${isotopereadingtest_SRCS})
-target_link_libraries(isotopereadingtest ${KDE4_KDECORE_LIBS} science )
+#target_link_libraries(isotopereadingtest ${KDE4_KDECORE_LIBS} science )
-endif(KDE4_BUILD_TESTS)
+#endif(KDE4_BUILD_TESTS)
########### next target ###############
-/* Sample parsing with QT's SAX2 by Riku Leino <tsoots@gmail.com> */
-
-#include "../elementparser.h"
-#include "../element.h"
#include <kdebug.h>
#include <iostream>
+#include <qtextstream.h>
+#include <qfile.h>
+#include <qdatetime.h>
+#include <qxml.h>
+
+#include "../cml/xml_cml.h"
+#include "../cml/cmlclasses.h"
+
int main(int argc, char *argv[])
{
if (argc < 2 || argc > 2) {
return 1;
}
- ElementSaxParser * parser = new ElementSaxParser();
- QFile xmlFile(argv[1]);
- QXmlInputSource source(xmlFile);
- QXmlSimpleReader reader;
-
- reader.setContentHandler(parser);
- reader.parse(source);
-
- QList<Element*> v = parser->getElements();
-
- foreach( Element* e, v ){
- if ( e )
- {
- QList<ChemicalDataObject*> list = e->data();
-
- //Test: Check if the string-comparison works
-//X if ( e->data( ChemicalDataObject::name ) == "Helium" )
-//X kDebug() << "Mass: " << e->dataAsString( ChemicalDataObject::mass ) << endl;
-
- //Test: Check if the double-comparison works
-//X if ( e->data( ChemicalDataObject::mass ) == 4.002602 )
-//X kDebug() << "Correct mass found" << endl;
-
- //Test: Give me the name of the element
-//X kDebug() << "Name: " << e->dataAsString( ChemicalDataObject::name ) << endl;
-
- //Test: give me all data available
- foreach( ChemicalDataObject*o, list ){
- if ( o )
- {
- QString unit = o->unitAsString();
- if ( unit == "bo:noUnit" )
- unit = "";
- kDebug() << "Name: " << o->dictRef() << " " << o->valueAsString() <<" " << unit << endl;
- }
- }
- }
-
- }
+ CMLParser *handler = new CMLParser();
+
+ QFile xmlFile(argv[1]);
+
+ if ( !xmlFile.open( IO_ReadOnly ) )
+ return false;
+
+ QTextStream t1( &xmlFile );
+
+ QXmlInputSource source;
+// source.setData( t1 );
+
+ QXmlSimpleReader xmlReader;
+ xmlReader.setContentHandler( handler );
+
+ xmlReader.parse( source );
return 0;
}