R
Roger Flores
I'm releasing two projects of mine, Ali and Alo. They're at SourceForge.net
http://alo.sourceforge.net/
http://ali.sourceforge.net/
Alo is a concise way in ANSI C code to write data in XML format to a file.
If you're using printf to write XML, take a look at Alo.
Ali is an XML parser that reads structured XML data into C data structures
in a way convenient for your ANSI C code. The result is that your code is
smaller and easy to understand. Most other solutions like SAX and require
many callback functions.
Suppose you want to output address book data like:
<person id="1000">
<name>Roger Flores</name>
<zipcode>94062</zipcode>
<state>CA</state>
</person>
You could write C code using Alo like this:
rootN = alo_open(&doc, "person.xml", true, false, "");
personN = alo_out(doc, rootN, "^e", 0, "person");
alo_out(doc, personN, "^a%u", 0, "id", person[index].id);
alo_out(doc, personN, "^e%s", 0, "name", person[index].name);
alo_out(doc, personN, "^e%u", 0, "zipcode", person[index].zipcode);
alo_out(doc, personN, "^e%s", 0, "state",
state_abbreviations[person[index].state]);
alo_close(&doc);
Reading XML using Ali is basically the opposite, and about the same amount
of work.
Both projects are small. Alo is about 4KB and Ali 7KB compiled.
I wrote them so an app of mine could load and save it's dat in XML/RDF and
realized I should make them available to others. Ali isn't a conforming XML
processor (http://www.w3.org/TR/2004/REC-xml-20040204/#dt-xml-proc) because
it's fairly incomplete compared to the XML spec. Alo supports more XML
notations than Ali because it's easier to code a writer than a reader. But
they both cover my XML data needs!
Take a look and try them and let me know what you think.
-Roger Flores
mailto:[email protected]
http://alo.sourceforge.net/
http://ali.sourceforge.net/
Alo is a concise way in ANSI C code to write data in XML format to a file.
If you're using printf to write XML, take a look at Alo.
Ali is an XML parser that reads structured XML data into C data structures
in a way convenient for your ANSI C code. The result is that your code is
smaller and easy to understand. Most other solutions like SAX and require
many callback functions.
Suppose you want to output address book data like:
<person id="1000">
<name>Roger Flores</name>
<zipcode>94062</zipcode>
<state>CA</state>
</person>
You could write C code using Alo like this:
rootN = alo_open(&doc, "person.xml", true, false, "");
personN = alo_out(doc, rootN, "^e", 0, "person");
alo_out(doc, personN, "^a%u", 0, "id", person[index].id);
alo_out(doc, personN, "^e%s", 0, "name", person[index].name);
alo_out(doc, personN, "^e%u", 0, "zipcode", person[index].zipcode);
alo_out(doc, personN, "^e%s", 0, "state",
state_abbreviations[person[index].state]);
alo_close(&doc);
Reading XML using Ali is basically the opposite, and about the same amount
of work.
Both projects are small. Alo is about 4KB and Ali 7KB compiled.
I wrote them so an app of mine could load and save it's dat in XML/RDF and
realized I should make them available to others. Ali isn't a conforming XML
processor (http://www.w3.org/TR/2004/REC-xml-20040204/#dt-xml-proc) because
it's fairly incomplete compared to the XML spec. Alo supports more XML
notations than Ali because it's easier to code a writer than a reader. But
they both cover my XML data needs!
Take a look and try them and let me know what you think.
-Roger Flores
mailto:[email protected]