문제

I've QDomElement object and did the following to convert it to QDomDocument.

// element is the QDomElement object 
QString str;
QTextStream stream(&str, QIODevice::WriteOnly);
element.save(stream, 2); // stored the content of QDomElement to stream

QDomDocument doc;
doc.setContent(str.toUtf8()); // converted the QString to QByteArray

But what about the convertion from QDomDocument to QDomElement? By the way, is there any constructive way to convert QDomElement to QDomDocument?

올바른 솔루션이 없습니다

다른 팁

here is the conversion

 QDomDocument doc;
 doc.setContent( <YOUR XML GOES HERE> );
 QDomElement root = doc.documentElement();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top