| ||||
ixemolla is a small SAX-like XML parser writen in plain ANSI C.
This is a simple example that, for each element, print its name. int print(int type, char *start, char *end, int needconv, void *usr) { ptrdiff_t len=end-start; if (IXET_START!=type) return 0; fwrite(text, end-start, 1, stdout); printf("\n"); return 0; } int example() { IxeInfo ei; int err; err=ixemolla(xmlSource, &print, 0, &ei); if (err) printf("error at line %d, column %d\n", ei.line, ei.column); return err; } Next example show how encoded contents can be decoded. The parameter
needconvis set to one each time text need convertion. int decode(int type, char *start, char *end, int needconv, void *usr) { ptrdiff_t len=end-start; char *decoded; int err; if (IXET_CONTENT!=type || !needconv) return 0; decoded=(char*)malloc(len+1); err=ixedecode(text, len, to); if (err) return err; printf("%s\n", decoded); free(decoded); return 0; }
ixemolla project is hosted from SourceForge.
This is the project
homepage. svn co https://ixemolla.svn.sourceforge.net/svnroot/ixemolla ixemolla Add '/trunk' to the HTTPS URL above to check out only trunk (main development line).
This is an obfuscated version of the ixemolla beta1 source code; Only comments, spaces and CR have been removed: Get source code and try ixemolla! :-D | ||||