QDomDocument & OS Crash on doc.createElementNS
Why this crash ...?
is an other method to debug?
Code:
{
qDebug() << "### open file " << inputfile;
if (file.exists()) {
qDebug() << "### file found ok " << inputfile;
inside =file.readAll();
file.close();
}
}
doc.createElementNS("http://www.pulitzer.ch/2005/shop/shema/1.0/","s");
doc.createElementNS("http://www.pulitzer.ch/2005/PuliCMS/1.0","cms");
doc.appendChild(root);
QDomElement page
= doc.
createElementNS("http://www.pulitzer.ch/2005/PuliCMS/1.0",
"page");
root.appendChild(page);
QDomAttr language
= e.
attributeNode("la");
language.setValue(set_lang);
page.setAttributeNodeNS(language);
QDomText t
= doc.
createTextNode(inside
);
/* filter self text? */ page.appendChild(t);
qDebug() << "### xml result " << xml;
return xml;
}
Re: QDomDocument & OS Crash on doc.createElementNS
Have you tried doing a stack-trace using a debugger? Is doc NULL?
Re: QDomDocument & OS Crash on doc.createElementNS
Quote:
Originally Posted by patrik08
Why this crash ...?
is an other method to debug?
Maybe this thread helps.
Code:
// createElementNS() returns the newly created element,
// following 2 lines have no point at all..
doc.createElementNS("http://www.pulitzer.ch/2005/shop/shema/1.0/","s");
doc.createElementNS("http://www.pulitzer.ch/2005/PuliCMS/1.0","cms");
// you initialize an empty (null) element and then ask for it's "la" attribute?
QDomAttr language
= e.
attributeNode("la");
language.setValue(set_lang);
page.setAttributeNodeNS(language);
// i guess it should be more like this (instead of those 4 wicked lines)
// page.setAttribute("la", set_lang);
[/QUOTE]
Re: QDomDocument & OS Crash on doc.createElementNS
So is running but xml is no utf8 ..... or no unicode....
i like text on xml file so on server cms.... (i tested tidy or qt4 asci and textstream codec)
I have a php function "utf8_to_unicode" but is not possibel to run on qt4 ....
original function unicode xml files ... http://ppk.ciz.ch/format/qt/Multi_Language.phps
http://ppk.ciz.ch/format/qt/unicote_text.png
Is not possibel to post this text on forum.... on post rewrites....
The reusult on the cms i can write any language.... this is text from image...
Quote:
提契诺州的美味佳肴具有意大利风格,同时具有自己的独特之处。纯正的本地风味可以在这个地区特有的"tra ttorie", "grotti"(客栈)或是餐馆中享用,它们都是流行的聚会场所,最初却是冬季出售葡萄酒和熟食 的小店。
提契诺葡萄酒中的极品无疑当数源自法国波尔多地区的墨尔乐红葡萄酒。自19世纪初开始从法国引进这种葡萄酒 以取代当地葡萄酒以来,墨尔乐葡萄酒就适应了提契诺州的气候,并在这里取得了辉煌的成功。
Code:
{
qDebug() << "### open file " << inputfile;
if (file.exists()) {
qDebug() << "### file found ok " << inputfile;
inside =file.readAll();
file.close();
}
}
root.setAttribute("xmlns:s","http://www.pulitzer.ch/2005/shop/shema/1.0/");
root.setAttribute("xmlns:cms","http://www.pulitzer.ch/2005/PuliCMS/1.0/");
doc.appendChild(root);
page.setAttribute("xmlns:cms","http://www.pulitzer.ch/2005/PuliCMS/1.0/");
page.setAttribute("la",set_lang);
QDomText t
= doc.
createTextNode(inside
);
page.appendChild(t);
root.appendChild(page);
qDebug() << "### xml result " << ilmiofile.data();
return ilmiofile.data();
}
Only this qt function transorm a xml utf8 ... but on qtextedit show normal iso....
Code:
bool Gui_Tidy
::file_put_contents_utf8(QString fullFileName,
QString xml
) {
/*QTextCodec *codeclatin1 = QTextCodec::codecForMib(4);*/
{
sw.setCodec(codecutf8);
sw << data;
f.close();
return true;
}
return false;
}