I built a pure Swift XML parser (no DTD, external entity, transcoding support) at https://github.com/compnerd/xylem. Some informal testing indicated that it is faster than libxml2 and xmloxide, a rust port of libxml2.
GitHub - compnerd/xylem: XML Parsing Library
XML Parsing Library. Contribute to compnerd/xylem development by creating an account on GitHub.
@compnerd Sigh, a tad too late for me, I would have just used that :-) (I just did a similar Expat variant for my own needs, I did some very heavy perf testing and in many things its almost twice as fast as Expat)
@compnerd In the SAX parser, if you make the ResolvedAttributes "borrowing", you can keep one shared instance in the parser, reusing it for any start call (and the delegate can extract what it actually needs). The XML.Byte is a little weird, are there actually systems where a byte is not UInt8? 🙂