Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
| 4728 | |
| 4729 | // Streams an XML CDATA section, escaping invalid CDATA sequences as needed. |
| 4730 | void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream, |
| 4731 | const char* data) { |
| 4732 | const char* segment = data; |
| 4733 | *stream << "<![CDATA["; |
| 4734 | for (;;) { |
| 4735 | const char* const next_segment = strstr(segment, "]]>"); |
| 4736 | if (next_segment != NULL) { |
| 4737 | stream->write( |
| 4738 | segment, static_cast<std::streamsize>(next_segment - segment)); |
| 4739 | *stream << "]]>]]><![CDATA["; |
| 4740 | segment = next_segment + strlen("]]>"); |
| 4741 | } else { |
| 4742 | *stream << segment; |
| 4743 | break; |
| 4744 | } |
| 4745 | } |
| 4746 | *stream << "]]>"; |
| 4747 | } |
| 4748 | |
| 4749 | void XmlUnitTestResultPrinter::OutputXmlAttribute( |
| 4750 | std::ostream* stream, |