* xmlTextWriterWriteRawLen: * @writer: the xmlTextWriterPtr * @content: text string * @len: length of the text string * * Write an xml text. * TODO: what about entities and special chars?? * * Returns the bytes written (may be 0 because of buffering) or -1 in case of error */
| 1341 | * Returns the bytes written (may be 0 because of buffering) or -1 in case of error |
| 1342 | */ |
| 1343 | int |
| 1344 | xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content, |
| 1345 | int len) |
| 1346 | { |
| 1347 | int count; |
| 1348 | int sum; |
| 1349 | xmlLinkPtr lk; |
| 1350 | xmlTextWriterStackEntry *p; |
| 1351 | |
| 1352 | if (writer == NULL) { |
| 1353 | xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, |
| 1354 | "xmlTextWriterWriteRawLen : invalid writer!\n"); |
| 1355 | return -1; |
| 1356 | } |
| 1357 | |
| 1358 | if ((content == NULL) || (len < 0)) { |
| 1359 | xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, |
| 1360 | "xmlTextWriterWriteRawLen : invalid content!\n"); |
| 1361 | return -1; |
| 1362 | } |
| 1363 | |
| 1364 | sum = 0; |
| 1365 | lk = xmlListFront(writer->nodes); |
| 1366 | if (lk != 0) { |
| 1367 | p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk); |
| 1368 | count = xmlTextWriterHandleStateDependencies(writer, p); |
| 1369 | if (count < 0) |
| 1370 | return -1; |
| 1371 | sum += count; |
| 1372 | } |
| 1373 | |
| 1374 | if (writer->indent) |
| 1375 | writer->doindent = 0; |
| 1376 | |
| 1377 | if (content != NULL) { |
| 1378 | count = |
| 1379 | xmlOutputBufferWrite(writer->out, len, (const char *) content); |
| 1380 | if (count < 0) |
| 1381 | return -1; |
| 1382 | sum += count; |
| 1383 | } |
| 1384 | |
| 1385 | return sum; |
| 1386 | } |
| 1387 | |
| 1388 | /** |
| 1389 | * xmlTextWriterWriteRaw: |
no test coverage detected