Replace the notImplemented stub with a real parser built on a pull-based, streaming event core that never requires the whole document in memory. - Parsing.EventReader: pulls characters through a source closure with a bounded lookahead buffer and emits one Parsing.Event at a time, holding only an open-element stack. Drives chunked/streamed input. - Parsing.Parser: builds a Model.Node tree iteratively over the event core (explicit stack, no recursion). - Reader: streaming character cursor (closure-backed, bounded buffer) replacing the previous whole-string Array. - EntityDecoder: the five predefined entities and decimal/hex char references. - Handles elements, attributes, text, comments, CDATA, processing instructions, and an XML declaration in the prolog. Rejects <!DOCTYPE> by default (no DTD/XXE/entity-expansion exposure). - Top-level API: parse(_:), parse(pulling:), events(_:), events(pulling:). - 21 tests including event-stream and chunked-source coverage.
1.5 KiB
1.5 KiB
Changelog
All notable changes to PureXML are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
Added
- Initial package scaffold: root Swift package, namespacing under
PureXML, and the portability and verification gates carried over from PureYAML. - XML node model (
PureXML.Model):Node,Element,Attribute, andQualifiedName, preserving document order and node kinds. - XML emitter (
PureXML.Emitting.Serializer) with pretty-printed and compact output and correct text and attribute escaping. - Structural validation (
PureXML.Validation.Validator) for duplicate attribute names. - Streaming, iterative XML parser.
PureXML.Parsing.EventReaderis a pull-based event core that consumes input through a character-source closure and emits oneEventat a time, holding only bounded state (an open-element stack and a small lookahead buffer). It never requires the whole document in memory and can drive chunked input.PureXML.Parsing.Parserbuilds aModel.Nodetree iteratively over the event core (no recursion). Handles elements, attributes, text, the five predefined entities and numeric character references, comments, CDATA, and processing instructions. Safe by default:<!DOCTYPE>is rejected (no DTD/XXE). - Top-level API:
PureXML.parse(_:),PureXML.parse(pulling:), andPureXML.events(_:)/PureXML.events(pulling:)for streaming.