Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CDATA output containing ]]> is not well-formed XML

Open Beginner friendly
#1,097 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start by reading XMLPrinter::PushText and the XMLDocument::NewText/SetCData path named in the issue, then reproduce the example with a]]>b. Check that the emitted XML parses and round-trips to the original text in both usage paths; done means CDATA output containing ]]> remains well-formed without changing the value.

Written by the indexing model from the issue text.

Description

On master 8224e42, writing the text a]]>b in CDATA mode produces <r><![CDATA[a]]>b]]></r>. The embedded ]]> closes the CDATA section early and the remaining ]]> is invalid character data. Python's xml.etree parser rejects the output. Normal-text mode writes <r>a]]&gt;b</r> and round-trips the original value.

This occurs both with XMLDocument::NewText("a]]>b") followed by SetCData(true) and with XMLPrinter::PushText("a]]>b", true). XMLPrinter::PushText writes the value directly between the CDATA delimiters. Would splitting the value across adjacent CDATA sections be an acceptable fix? That can preserve the text while producing valid XML. AI-assisted investigation and reproduction.

Dominant language
C++
Stars
5.8k
Forks
2k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from leethomason/tinyxml2

All issues in leethomason/tinyxml2

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.