Hi all,
I would like to embed an image inside an xml. My idea is to use a CDATA node, but I'm not sure how to achieve this.
Thanks in advance.
Ignasi Mateos
Hi again,
I'm trying to embed an image inside an XML, that's what I've done till now:
...
ifstream imageFile;
imageFile.open(imageFilename, ios::in | ios::binary); imageFile.seekg(0, ios::end); streamsize length = imageFile.tellg();
if (length != 0) { imageFile.seekg(0, ios::beg);
char *pRaw = new char[length]; imageFile.read((char*)pRaw, length);
TiXmlElement *imageElem = new TiXmlElement("IMG"); imageElem->SetAttribute("Data", pRaw); rootElem->LinkEndChild(imageElem); } imageFile.close();
But it's only saved the fist four bits...Does anyone know what I'm doing wrong?
Log in to post a comment.
Hi all,
I would like to embed an image inside an xml. My idea is to use a CDATA node, but I'm not sure how to achieve this.
Thanks in advance.
Ignasi Mateos
Hi again,
I'm trying to embed an image inside an XML, that's what I've done till now:
...
ifstream imageFile;
imageFile.open(imageFilename, ios::in | ios::binary);
imageFile.seekg(0, ios::end);
streamsize length = imageFile.tellg();
if (length != 0)
{
imageFile.seekg(0, ios::beg);
char *pRaw = new char[length];
imageFile.read((char*)pRaw, length);
TiXmlElement *imageElem = new TiXmlElement("IMG");
imageElem->SetAttribute("Data", pRaw);
rootElem->LinkEndChild(imageElem);
}
imageFile.close();
...
But it's only saved the fist four bits...Does anyone know what I'm doing wrong?
Thanks in advance.