elcuco
21st August 2014, 06:04
(continuing http://www.qtcentre.org/threads/60004-reading-XML-node-and-sub-nodes )
I am using QXmlStreamWriter, and under some conditions I need to write into a node, a text that contains raw xml, not encoded.
QString b = "<b>test 1 2 3 </b>";
QXmlStreamWriter stream(&output);
stream.writeStartDocument();
stream.writeStartElement("a");
stream.writeCharacters(b);
stream.writeEndElement();
stream.writeEndDocument();
stream.close();
In this example, "b" gets encoded into XML, which is usually desired, but not in this case.
One solution I have is to write the XML manually as a text file. This will work, but I feel this is ugly.
What other alternatives to I have?
I am using QXmlStreamWriter, and under some conditions I need to write into a node, a text that contains raw xml, not encoded.
QString b = "<b>test 1 2 3 </b>";
QXmlStreamWriter stream(&output);
stream.writeStartDocument();
stream.writeStartElement("a");
stream.writeCharacters(b);
stream.writeEndElement();
stream.writeEndDocument();
stream.close();
In this example, "b" gets encoded into XML, which is usually desired, but not in this case.
One solution I have is to write the XML manually as a text file. This will work, but I feel this is ugly.
What other alternatives to I have?