Confluence Throws 'The XML Content Could Not Be Parsed' Error When Viewing A Page
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
When viewing a page, it will not render and we receive the following error in the user interface.

The following appears in the atlassian-confluence.log:
1
2
3
4
5
6
Error: The XML content could not be parsed. There is a problem at
line x, column y. Parser message: String ']] >' not allowed in
textual content, except as the end marker of CDATA section at [row,col
{unknown-source}
]: [x,y]
Cause 1
This happens due to an existing character which conflicts with XML standards. The offending character appears in the error message as String ']]>' from the above log entry. In this example, '>' is the offending character.
Cause 2
This error can also be caused by a NULL value in bodytypeid
after the XHTML Migration when upgrading Confluence. Running the following query will identify pages that are affected by this problem:
1
2
3
4
5
6
SELECT *
FROM BODYCONTENT
WHERE contentid IN (
SELECT c.contentid FROM CONTENT AS c WHERE CONTENTTYPE IN ('PAGE', 'COMMENT', 'BLOGPOST')
)
AND bodytypeid IS NULL;
Resolution 1
⚠️ This resolution covers specifically>
and replacing it with it's XML encoding of >
. For a list of other characters and their encodings please see List of XML and HTML character entity references.
As an initial troubleshooting step, we could also run the following SQL query from the Database for us to review what is being stored in Confluence Database for the affected page (source of truth):
ℹ️ Please modify the pageName and spaceName parameters accordingly.
1
2
3
4
5
6
7
8
SELECT c.contentid, c.title, s.spacekey, bc.body
FROM CONTENT c JOIN BODYCONTENT bc
ON c.contentid = bc.contentid JOIN SPACES s
ON c.spaceid = s.spaceid
WHERE c.prevver IS NULL
AND c.contenttype IN ('PAGE', 'BLOGPOST')
AND c.title LIKE '<pageName>'
AND s.spacename LIKE '<spaceName>';
Install the Confluence source editor plugin
Navigate to the offending page and click
...
>View Storage Format
, to get storage format of the affected pageCopy the resultant text to the clipboard
On the same page click
Edit
><>
to open the source editorDelete the existing content in the source editor
Paste the contents of the clipboard into the source editor
Find any instance of
>
that is not being used in a proper XML tag and replace with>
Save these changes
Resolution 2
ℹ️ Before making any changes to your database, ensure that you have a full database backup and that Confluence is shut down. Then, execute the following query:
1
2
3
4
5
6
7
UPDATE
BODYCONTENT
SET bodytypeid = 0
WHERE contentid IN (
SELECT c.contentid FROM CONTENT AS c WHERE CONTENTTYPE IN ('PAGE', 'COMMENT', 'BLOGPOST')
)
AND bodytypeid IS NULL;
Was this helpful?