← All notes

Python xml.sax: support for SAX2 parsers

Answer: A typical SAX application uses three kinds of objects: readers, handlers and input sources.

Convenience functions

The package itself provides the SAX exceptions and the convenience functions most used by users of the SAX API.

make_parser creates and returns a SAX XMLReader object.

The first parser found will be used.

The handler parameter needs to be a SAX ContentHandler instance.

There is no return value; all work must be done by the handler passed in.

Security and typical shape

If you need to parse untrusted or unauthenticated data, see the XML security guidance.

The SAX parser no longer processes general external entities by default, which increases security.

A typical SAX application uses three kinds of objects: readers, handlers and input sources.

The reader invokes a method on the handler.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, xml.sax — Support for SAX2 parsers; CPython, xml.sax documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, xml.sax — Support for SAX2 parsers; CPython, xml.sax documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.

Cite this

Permanent ID: iil:note:a62q8d7w

iinventedlight. 2026. "Python xml.sax: support for SAX2 parsers." iinventedlight Library, iil:note:a62q8d7w, version of 2026-11-24. https://iinventedlight.com/library/notes/python-xml-sax/. License: CC-BY-4.0.

@misc{iil_note_a62q8d7w,
  author = {{iinventedlight}},
  title = {{Python xml.sax: support for SAX2 parsers}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-24},
  url = {https://iinventedlight.com/library/notes/python-xml-sax/},
  note = {Permanent ID iil:note:a62q8d7w. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-xml-sax.md.