Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QDomNode/Element to XML
PhantomR last edited by PhantomR
Is there any direct method to transform a QDomNode / QDomElement to its XML code? I read that there's a "save' method in QDomElement or so, but isn't there something quicker ("quicker" .. I mean without having to provide a stream which that method requires)?
QDomNode node; node.toDocument().toString();
I have not checked it, though, it might not work.
PhantomR last edited by
Thank you for your answer. It seems to return an empty text. After reading through the documentation, I've found that running toDocument() on a non-document will produce a null object, so that's probably why. The "save" method works, however. I've packed the writing calls (with the stream and all) in a method and it's not that lengthy to call anymore :).
OK, nicely done :)
Venkatesh V last edited by
text() returns the element's text content. Example:
In this case text() will return "My text". So it is not what OP wants.