On this page
parse-xml1
Prev: parse-mw | Up: projects | Next: parse-yaml
Rel: wispsy, Foundation, parse-html5, parse-yaml, parse-toml
Ref: wispsy on GitHub
Tags: #public #wispsy #project #foundation #tier/standard
Role
Source-preserving XML 1.0 parser for Python 3.14+ (0.1.0, zero runtime deps)—retaining exact source including declarations, comments, processing instructions, CDATA sections, whitespace, and entity references, with configurable character/node/nesting/entity-expansion limits and zero external DTD/entity fetches.
Install
python -m pip install parse-xml1
Quickstart
from parse_xml1 import Element, Text, parse
document = parse('<?xml version="1.0"?><greeting lang="en">Hello, XML!</greeting>')
greeting = document.root
assert isinstance(greeting, Element)
assert greeting.name == "greeting"
assert greeting.attributes[0].value == "en"
assert isinstance(greeting.children[0], Text)
assert greeting.to_xml() == '<greeting lang="en">Hello, XML!</greeting>'
When to Reach for It
- Parsing XML 1.0 documents with explicit safety bounds, preserved source spans, and safe entity handling without third-party XML stacks.
- Reach for parse-html5 for HTML5 documents or astree for CSS-selector extraction.
Gotchas & Pitfalls
- Zero external DTD/entity fetches: External entities and remote DTD resolution are disabled by design to prevent XXE and SSRF—documents relying on external DTDs will raise bounded errors.
- Entity expansion limits: Billion-laughs-style recursive entity expansion is blocked by configurable character, node, nesting, and expansion caps.
- XML 1.0 strictness: Rejects malformed HTML-style unclosed tags; use parse-html5 for HTML5 input.
Pairs With
- parse-html5, parse-md, parse-mw — Sibling bounded markup parsers.
- parse-yaml & parse-toml — Sibling bounded structured-data parsers.
Metadata
type: project-card
slug: parse-xml1
org: wispsy
repo: wispsy/parse-xml1
package: parse-xml1
import_name: parse_xml1
version: 0.1.0
requires_python: ">=3.14"
layer: foundation
topic: wispsy-foundation
status: active
language: python
source_docs: README.md, docs/
Linked from
Related notes
- wiki/projects/parse-mw Linked here; links to this page; shared tags: #foundation, #project, #tier, #wispsy
- wiki/projects/parse-toml Linked here; links to this page; shared tags: #foundation, #project, #tier, #wispsy
- wiki/projects/parse-yaml Linked here; links to this page; shared tags: #foundation, #project, #tier, #wispsy
- wiki/stack/foundation Linked here; links to this page; shared tags: #foundation, #tier, #wispsy
- wiki/projects Linked here; links to this page; shared tags: #wispsy
- wiki/projects/astree Linked here; shared tags: #foundation, #project, #tier, #wispsy
- wiki/projects/parse-html5 Linked here; shared tags: #foundation, #project, #tier, #wispsy
- wiki/projects/parse-md Linked here; shared tags: #foundation, #project, #tier, #wispsy
- wiki/choosing links to this page; shared tags: #tier, #wispsy
- wiki/compatibility links to this page; shared tags: #tier, #wispsy