Expat is a
stream
A stream is a continuous body of water, body of surface water Current (stream), flowing within the stream bed, bed and bank (geography), banks of a channel (geography), channel. Depending on its location or certain characteristics, a strea ...
-oriented
XML 1.0 parser
library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
, written in
C, more precisely
C99. As one of the first available
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
XML parsers, Expat has found a place in many open-source projects. Such projects include the
Apache HTTP Server
The Apache HTTP Server ( ) is a free and open-source software, free and open-source cross-platform web server, released under the terms of Apache License, Apache License 2.0. It is developed and maintained by a community of developers under the ...
,
Mozilla
Mozilla is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, publishes and supports Mozilla products, thereby promoting free software and open standards. The community is supported institution ...
,
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
,
Python and
PHP. It is also
bound in many other languages.
Naming
According to the original creator, the name Expat came from the fact that he was an
expat
An expatriate (often shortened to expat) is a person who resides outside their native country.
The term often refers to a professional, skilled worker, or student from an affluent country. However, it may also refer to retirees, artists and ...
at the time. The "ex" and the "pa" are for XML and parsing.
Timeline
Software developer
James Clark released version 1.0 in 1998 while serving as technical lead on the XML Working Group at the
World Wide Web Consortium
The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working together in ...
. Clark released two more versions, 1.1 and 1.2, before turning the project over to a group led by Clark Cooper and Fred Drake in 2000. The new group released version 1.95.0 in September 2000 and continues to release new versions to incorporate bug fixes and enhancements.
Versions up to 2.5.0 have a Score 7.5 (High) DoS vulnerability CVE-2023-52425.
Availability
GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
hosts the Expat project. Versions exist for most major operating-systems.
Deployment
To use the Expat library, programs first register handler functions with Expat. When Expat parses an XML document, it calls the registered handlers as it finds relevant tokens in the input stream. These tokens and their associated handler calls are called ''events''. Typically, programs register handler functions for XML element start or stop events and character events. Expat provides facilities for more sophisticated event handling such as
XML Namespace declarations, processing instructions and
DTD events.
Expat's parsing events resemble the events defined in the
Simple API for XML
SAX (Simple API for XML) is an event-driven online algorithm for lexing and parsing XML documents, with an API developed by the XML-DEV mailing list. SAX provides a mechanism for reading data from an XML document that is an alternative to tha ...
(SAX), but Expat is not a SAX-compliant parser. Projects incorporating the Expat library often build SAX and possibly
DOM parsers on top of Expat. While Expat is mainly a stream-based (push) parser, it supports stopping and restarting parsing at arbitrary times, thus making the implementation of a ''pull'' parser relatively easy as well.
References
{{Reflist
External links
Expat Project Home Page
XML parsers
C (programming language) libraries
Software using the MIT license