Test files › Structured data › unclosed-tag.xml

Malformed XML with an unclosed tag

XML with a tag that is never closed.

↓ Download unclosed-tag.xml
Filenameunclosed-tag.xml
FormatXML
Size51 bytes (51 bytes)
MIME typeapplication/xml
SHA-2567de03c5a454c2e81def4c6bf72d0e35f80e24d7f8e2a40d60e9cabd51598477a
What this file catchesError reporting quality - the message should include a line and column.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

Python's standard parser (expat 2.4.1 or later) refuses entity-expansion bombs and does not fetch external entities, so this file fails to parse instead of attacking you. Parsers in other languages differ: make sure DTDs and external entities are disabled in yours. For untrusted XML in Python, the defusedxml package forbids entity declarations outright.

import xml.etree.ElementTree as ET

try:
    ET.parse("unclosed-tag.xml")
    print("parsed")
except ET.ParseError as e:
    print("refused:", e)

Run against this file, it prints: refused: mismatched tag: line 4, column 2

Related guides and tools

Sample XML fileUpload validation checklistVerify its SHA-256

Download & verify

curl -fsSL -o "unclosed-tag.xml" "https://files.hexaqa.com/xml/unclosed-tag.xml"
curl -fsSL "https://files.hexaqa.com/xml/unclosed-tag.xml" | sha256sum # expect: 7de03c5a454c2e81def4c6bf72d0e35f80e24d7f8e2a40d60e9cabd51598477a

More structured data test files

ndjson-10000-lines.ndjsonprecision-loss.jsonvalid-small.jsonbillion-laughs.xmlvalid.xmlxxe-file-disclosure.xmlnorway-problem.yamltabs-invalid.yaml

← All Structured data files