bei meinem code geht er ohne fehler durch bis zu
if( root.tagName() != "cms:wget" ) dann kann er nicht weiter.....
wenn ich die Namespace wegnehme gehts...
ist dass normal?
<html> und <xhtml:html> ist doch auch nicht dass selbe...
Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8"?>
<cms:wget xmlns:cms="http://www.pulitzer.ch/2005/PuliCMS/1.0">
<requestfile sqlurl="http://ppk.ciz.ch/format/sql/php5_export.sql" localname="citta.sql" />
<requestfile sqlurl="http://ppk.ciz.ch/format/sql/qt_export.sql" localname="qtcitta.sql" />
<requestfile sqlurl="http://ppk.ciz.ch/format/sql/citta_svizzere.sql" localname="sxcitta.sql" />
</cms:wget>
Code: Alles auswählen
int DB_Setup::Download_File( int next )
{
QString configwget = "inifile.xml";
QFile xmlfile(configwget);
if(!xmlfile.open( QIODevice::ReadOnly ) ) {
QMessageBox::warning( this, tr( "Database Error!" ), tr( "Not possibel to open config file!" ) );
return 0;
}
QString errorStr;
int errorLine;
int errorColumn;
QDomDocument doc("http://www.pulitzer.ch/2005/PuliCMS/1.0");
if (!doc.setContent(&xmlfile,true, &errorStr, &errorLine, &errorColumn)) {
QMessageBox::warning( this, tr( "Database Error! & XML Error!" ),
tr("Parse error at line %1, column %2:\n%3" )
.arg(errorLine)
.arg(errorColumn)
.arg(errorStr) );
xmlfile.close();
return 0;
}
QDomElement root = doc.documentElement();
if( root.tagName() != "cms:wget" ) {
QMessageBox::warning( 0, tr( "Database Error!" ), tr( "Not possibel to read config file!" ) );
return 0;
}
incomming_file.clear(); /* QStringList incomming_file.count()*/
total_db_file_import = 0;
QString url, name_of_file, user, pass;
QDomNode n = root.firstChild();
while( !n.isNull() )
{
QDomElement e = n.toElement();
if( !e.isNull() )
{
if( e.tagName() == "requestfile" )
{
total_db_file_import++;
url = e.attribute( "sqlurl", ".error" );
name_of_file = e.attribute( "localname", ".error" );
user = e.attribute( "user", "" );
pass = e.attribute( "pass", "" );
/* file_put_contents_append("res.dat",QString( "%1 %2 %3" ).arg( QString::number(total_db_file_import) , url , name_of_file )); */
incomming_file.append(name_of_file);
if (next == total_db_file_import) {
Wget_File(next, url , DB_IMPORT_CACHEDIR + name_of_file , user , pass );
}
}
}
n = n.nextSibling();
}
xmlfile.close();
return next + 1;
}