Deterministic
One-pass scanning
A finite-state machine advances character by character. Equal inputs produce equal outputs, without formatter preferences.
xmlsquish recursively processes XML prompts, collapsing layout whitespace while keeping exactly one space between tag/tag, tag/word, and word/tag boundaries.
Inputs stay untouched; results are written beside them as .o.xml files.
This is not a semantics-preserving XML minifier. It rewrites ordinary character-data whitespace, may change mixed-content meaning, and does not honor xml:space="preserve". Use it only where that whitespace is known layout noise.
<role>
You are a careful agent.
</role>
<task>
Summarize this.
</task><role> You are a careful agent. </role> <task> Summarize this. </task>Do less, precisely
This is a prompt-oriented lexical canonicalizer, not an XML Infoset minifier: it normalizes XML whitespace in ordinary character data without building a DOM.
Deterministic
A finite-state machine advances character by character. Equal inputs produce equal outputs, without formatter preferences.
Batch-ready
Pass many paths at once. Directories discover *.xml recursively; globs fit into existing workflows.
Traceable
Each result lands in a matching *.o.xml file, leaving readable source prompts as the reviewable source of truth.
Mechanism, not magic
The scanner forms Word atoms from ordinary character data and complete Markup atoms from structures. It defers whitespace runs, then one emitter joins adjacent atoms.
DATACharacter dataForm Word atoms and defer XML S whitespace runs.
TAGTagA > inside a quoted attribute does not end the tag.
COMMENT / CDATA / PIDelimited structuresRecognize each terminator and preserve interior bytes verbatim.
DOCTYPEDocument typeTrack quotes, comments, PIs, and internal-subset bracket depth.
Zero-ceremony batching
Pass any number of files, directories, or globs. With no arguments, xmlsquish prints its help.
Directories are searched recursively for *.xml; every input creates a matching *.o.xml beside it.
$ cargo install --path crates/xmlsquish-cli --locked
$ xmlsquish ./prompts "templates/*.xml"
✓ 12 files processedAccount for every run
A summary covers files, tokens, characters, and whitespace, so compression stays measurable rather than anecdotal.
Illustrative values only; actual results depend on your files.