Philippe Paquet Tech blogging from Los Angeles

ppXml

ppXml
An object oriented XML library
Version 1.02 - 2 May 2007
[Philosophy] [Sample 1] [Sample 2] [License] [Download]

Philosophy
Does the world really need another XML library? Well, maybe. A few years ago, I did an evaluation of the XML libraries available. While I found some very good libraries, they were very complex to use, at least relatively to the service provided. I don't need validation, schema support or CDATA support. I need something that is simple enough so I can use it everyday, without having to plan program architecture around it. So, I wrote my own. Of course, my parser won't replace a full blown parser but that's not the point. If you need a full blown parser, use a blown parser. If you need something simple and straightforward, you should have a look at ppXml.

Sample 1

This sample demonstrate how to create the following book.xml file

<?xml version="1.0" encoding="ISO-8859-1"?>
<book>
<author>joe</author>
<isbn>123456</isbn>
</book>

#include "ppXml/ppXml.h"

int main(int argc, char *argv[])
{
CXmlDocument myXmlDocument;

myXmlDocument.SetText("book,author", "joe");
myXmlDocument.SetText("book,isbn", 123456);
myXmlDocument.WriteFile("book.xml");

return 0;
}

Sample 2

This sample demonstrate how to read and display values from book.xml create by sample 1

#include "ppXml/ppXml.h"

int main(int argc, char *argv[])
{
CXmlDocument myXmlDocument;

myXmlDocument.ReadFile("book.xml");

const char* achAuthor = myXmlDocument.GetText("book,author");
printf("Author: %s\n", achAuthor);

int iISBN = myXmlDocument.GetTextAsInt("book,isbn");
printf("ISBN: %i\n", iISBN);

return 0;
}

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

If you are unable to comply with the terms of the GNU General Public License, contact the copyright holder for a commercial license.

Download
ppXml_1.02.zip (506 Kb)