Sticker 016 · Back to James Clark’s sticker · Leggi la versione italiana
When two programs exchange an XML document, they need to read tags and attributes by the same rules. A shared library lets developers avoid writing an XML reader from scratch for each program. James Clark created Expat, an XML parsing library written in C, and announced its availability on 5 April 1998. It shows what a small component can achieve when the application using it gets to decide what to do with the data. Original Expat release announcement.
XML was a group effort
The W3C published its first XML 1.0 Recommendation on 10 February 1998. Clark was the working group’s technical lead. Jon Bosak chaired the group, and Tim Bray, Jean Paoli and C. M. Sperberg-McQueen co-edited the specification. XML defines, among other things, how to write and nest elements. Expat applies those rules to recognise the structure of a document. Original Recommendation and W3C working group credits.
How Expat reads a document through events
Imagine a catalogue with thousands of books. When Expat encounters the start of an element, some text or the end of the element, it calls functions the application registered for those events. The application can count the books or keep only their titles without storing a tree of the entire catalogue. An element’s text may arrive in pieces, so the application must join them if it needs the complete value. Expat checks that XML is well-formed. Checking it against a schema requires a separate tool. The documentation for Expat, now maintained by a community, identifies the MIT/X Consortium licence. Expat documentation and licence.
Four original lines by James Clark in Trang
Trang converts schemas, the rules that describe which elements a document may contain. In the excerpt below, added by Clark in a commit dated 5 February 2009, the format’s name selects the reader. rng denotes the XML syntax of RELAX NG and rnc its compact syntax. The two forms express rules for the same family of documents. The excerpt is reproduced from Trang’s Java source. Clark’s commit · Formats.java source file · Three-clause BSD licence for the revision.
if (name.equalsIgnoreCase("rng"))
return new SAXParseInputFormat();
if (name.equalsIgnoreCase("rnc"))
return new CompactParseInputFormat();
BSD licence for the excerpt
Copyright (c) 2001-2003 Thai Open Source Software Center Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
Neither the name of the Thai Open Source Software Center Ltd nor
the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.From groff to Expat’s legacy
Clark also started groff, the GNU version of the roff typesetting system. Groff turns text with formatting instructions into output for a terminal or formats such as PDF. Expat and groff solve different problems. Each makes a task common to many programs or workflows available as a reusable tool. Groff manual.
Featured image. Original AI-generated editorial illustration for this sticker.
Nominate a programmer for the album
Who has made an outstanding contribution to software? We welcome nominations for well-known and lesser-known programmers. Give us a name, a specific project or contribution and sources we can check. An email address is optional and helps if we need clarification. The editors review each nomination before deciding whether to publish it.
