Max Frai
Max Frai

Reputation: 64266

QDomNode to html

I have QDomNode object and I need to get html representation of data inside it. I found a method QDomNode::save( QTextStream & str, int indent ):

Writes the XML representation of the node and all its children to the stream str. This function uses indent as the amount of space to indent the node.

I tried to use it this way:

QDomNode table = ...;

QString *htmlTable;
QTextStream stream(htmlTable);

table.save(stream, 2);
qDebug() << htmlTable;

QDebug returns a pointer. And in other cases program fails. I think I use QTextStream wrong.

Upvotes: 1

Views: 717

Answers (1)

Raiv
Raiv

Reputation: 5781

You haven't reserved memory for your QString.

QString htmlTable;
QTextStream stream(&htmlTable);
table.save(stream, 2);

should work, but i haven't tested it.

Upvotes: 2

Related Questions