xml
Version, currently main branch1 version
- main branchlatestAug 19, 2025
github.com/ysbaddaden/xml.cr
Explore the XML universe (and later HTML) in pure Crystal
Installation
# Add this to your shard.yml
dependencies:
xml:
github: ysbaddaden/xml.cr
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- Apache-2.0
- Author
- Julien Portalier
Dependencies
Development Dependencies
- minitest*github: ysbaddaden/minitest.cr, branch: maindev
README
XML
An exploratory shard to handle XML ~~(and later HTML)~~ in pure Crystal.
XML::SAX (parser)
The foundation parser is a Simple API for XML parser, aka SAX. It's inspired
by The Expat XML parser API
document (not its code) with
adjustements for an Object Oriented languages, like a distinct
XML::SAX::Handlers class for example.
The choice for a SAX parser is because of its relative simplicity along with its extensible flexibility. The parser deals with the syntax, which you shouldn't care about, while the handlers let you build whatever you need, and discard the rest. You may generate a full blown DOM tree, decide to recover from errors, or validate the XML document, or stream a XML document while skipping over anything you don't care about.
So far, the non validating DOM parser is 95% conpliant with the XML Conformance Test Suites.
References:
- https://www.w3.org/TR/xml11/
- https://www.w3.org/TR/xml/
- https://www.w3.org/XML/Test/xmlconf-20080827.html
- https://libexpat.github.io/doc/api/latest/
XML::DOM
The initial draft for a DOM in Crystal. Follows the DOM spec, adapted for crystal (snake_case instead of lowerCamelCase names), but keeps the clunky namings. We might consider normalizing the API to be much less verbose (maybe).
References:
XPATH 1.0
... TODO ...
References:
LICENSE
Distributed under the Apache-2.0 LICENSE.
AUTHOR
Julien PORTALIER
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Aug 19, 2025
- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/ysbaddaden/xml.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1