IDE: Embarcadero XE5 c++ builder.
I'm trying to dump UnicodeStrings in XML CData sections.
Small extract of such a string:
u"‰PNG\r\n\x1A\n\0\0\0\rIHDR\0\0\0õ\0\0\02\b\x06\0\0\0„\\i\0\0\0\x01sRGB\0®Î\x1Cé\0\0\0\x04gAMA\0\0±\vüa\x05\0\0\0\tpHYs\0\0\x0EÃ\0\0\x0EÃ\x01Ço¨d\0\0\v¼IDATxÚíœypUÕ\x19ÀO\x06…°¤\x04D$ˆ²\b1š\b\[email protected]"
I know a XML document can contain non-ASCII characters and I thought the content of a XML CData section is not parsed by the XML parser( with the exception of the end-of-section indicator "[[>", which is not present in my data, checked for it ).
When creating(writing) a CData section, I'm still getting the "an invalid character was found in text content when creating node" error.
Code example:
_di_IXMLDocument pXMLDocument = NewXMLDocument("1.0");
// I've played around with the document encoding with no success, guessing it's only applicable while reading the document.
// pXMLDocument->SetEncoding(L"iso-8859-1");
String myString; // Unicode, contains my data string.
// 1st param of CreateNode method is of type UnicodeString.
di_IXMLNode pCDataNode = pXMLDocument->CreateNode( myString, ntCData );
Any thoughts on why this is failing? Encoding problem?