ezXML - XML Parsing C Library

version 0.8.6

ezXML is a C library for parsing XML documents inspired by simpleXML for PHP. As the name implies, it's easy to use. It's ideal for parsing XML configuration files or REST web service responses. It's also fast and lightweight (less than 20k compiled). The latest version is available here: ezxml-0.8.6.tar.gz

Example Usage

Given the following example XML document:

<?xml version="1.0"?>
  <team name="McLaren">
      <name>Kimi Raikkonen</name>
      <name>Juan Pablo Montoya</name>

This code snippet prints out a list of drivers, which team they drive for, and how many championship points they have:

ezxml_t f1 = ezxml_parse_file("formula1.xml"), team, driver;
const char *teamname;
for (team = ezxml_child(f1, "team"); team; team = team->next) {
    teamname = ezxml_attr(team, "name");
    for (driver = ezxml_child(team, "driver"); driver; driver = driver->next) {
        printf("%s, %s: %s\n", ezxml_child(driver, "name")->txt, teamname,
               ezxml_child(driver, "points")->txt);

Alternately, the following would print out the name of the second driver on the first team:

ezxml_t f1 = ezxml_parse_file("formula1.xml");
printf("%s\n", ezxml_get(f1, "team", 0, "driver", 1, "name", -1)->txt);

The -1 indicates the end of the argument list. That's pretty much all there is to it. Complete API documentation can be found in ezxml.h.

Known Limitations Licensing

ezXML was written by Aaron Voisine and is distributed under the terms of the MIT license.