* xmlBufDumpEntityContent: * @buf: output buffer * @content: entity content. * * This will dump the quoted string value, taking care of the special * treatment required by % */
| 705 | * treatment required by % |
| 706 | */ |
| 707 | static void |
| 708 | xmlBufDumpEntityContent(xmlOutputBufferPtr buf, const xmlChar *content) { |
| 709 | if (xmlStrchr(content, '%')) { |
| 710 | const char * base, *cur; |
| 711 | |
| 712 | xmlOutputBufferWrite(buf, 1, "\""); |
| 713 | base = cur = (const char *) content; |
| 714 | while (*cur != 0) { |
| 715 | if (*cur == '"') { |
| 716 | if (base != cur) |
| 717 | xmlOutputBufferWrite(buf, cur - base, base); |
| 718 | xmlOutputBufferWrite(buf, 6, """); |
| 719 | cur++; |
| 720 | base = cur; |
| 721 | } else if (*cur == '%') { |
| 722 | if (base != cur) |
| 723 | xmlOutputBufferWrite(buf, cur - base, base); |
| 724 | xmlOutputBufferWrite(buf, 6, "%"); |
| 725 | cur++; |
| 726 | base = cur; |
| 727 | } else { |
| 728 | cur++; |
| 729 | } |
| 730 | } |
| 731 | if (base != cur) |
| 732 | xmlOutputBufferWrite(buf, cur - base, base); |
| 733 | xmlOutputBufferWrite(buf, 1, "\""); |
| 734 | } else { |
| 735 | xmlOutputBufferWriteQuotedString(buf, content); |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | /** |
| 740 | * xmlBufDumpEntityDecl: |
no test coverage detected