| 141 | } |
| 142 | |
| 143 | bool XMLWrapper::convertFromString(const char *text, xmlChar *&xmlText) |
| 144 | { |
| 145 | bool result = false; |
| 146 | |
| 147 | xmlBufferPtr in = xmlBufferCreateStatic((void*) text, strlen(text)); |
| 148 | xmlBufferPtr out = xmlBufferCreate(); |
| 149 | int ret = xmlCharEncInFunc(mCharEncodingHandler, out, in); |
| 150 | if (ret >= 0) { |
| 151 | result = true; |
| 152 | #if LIBXML_VERSION >= 20800 |
| 153 | xmlText = xmlBufferDetach(out); |
| 154 | #else |
| 155 | xmlText = xmlStrdup(xmlBufferContent(out)); |
| 156 | #endif |
| 157 | } |
| 158 | |
| 159 | xmlBufferFree(in); |
| 160 | xmlBufferFree(out); |
| 161 | |
| 162 | return result; |
| 163 | } |
| 164 | |
| 165 | xmlDocPtr XMLWrapper::getDocument() const |
| 166 | { |