PDA

View Full Version : QDomElement to QByteArray ?



probine
2nd May 2006, 16:13
I am parsing a QByteArray. Inside the QByteArray there is text in XML form.

At some point in this XML, there is an Element that I want to consider and use it as QByteArray. The other Elements are used as text, therefore I can conver the element to text by doing something like: e.text();

How can I use the element and keep it as QByteArray ?

jacek
2nd May 2006, 16:24
Either use a CDATA section or encode your byte array in some way, so that it uses only ASCII characters (the easiest solution is to use BASE64, because Qt would do the conversion for you, but you also convert each byte to a hex value).

probine
2nd May 2006, 16:32
Inside the XML element there is an image, so I do not want to convert it to Ascii.

I want to treat the element as QByteArray.

jacek
2nd May 2006, 17:01
XML is text, not binary data. Either convert that QByteArray to text or try CDATA section.