I know this is an old post, but anyway....
GetProp doesn't seem to be "exported":
SLFST XML_SLFST[] ={
{ "versmodu" , versmodu },
{ "bootmodu" , bootmodu },
{ "finimodu" , finimodu },
{ "emsgmodu" , emsgmodu },
{ "sbxmlParseFile" , sbxmlParseFile },
{ "sbxmlNewDoc" , sbxmlNewDoc },
{ "sbxmlFreeDoc" , sbxmlFreeDoc },
{ "sbxmlNewNs" , sbxmlNewNs },
{ "sbxmlFreeNs" , sbxmlFreeNs },
{ "getchildren" , getchildren },
{ "setchildren" , setchildren },
{ "getnext" , getnext },
{ "setnext" , setnext },
{ "getprev" , getprev },
{ "setprev" , setprev },
{ "sbxmlSetProp" , sbxmlSetProp },
{ "sbxmlNewChild" , sbxmlNewChild },
{ "sbxmlNewTextChild" , sbxmlNewTextChild },
{ "sbxmlNewDocNode" , sbxmlNewDocNode },
{ "sbxmlDocDumpMemory" , sbxmlDocDumpMemory },
{ NULL , NULL }
};
I'm playing around with
mini-xml as a replacement for libxml. The static library of libxml is about 3megs now. mini-xml's static lib is about 250k, with debugging turned on (should be about 40-90k without).
Additionally, libxml has additional external dependencies, whereas the only dependency that mini-xml has is pthreads, which any decent C compiler already provides.
Quick example in C, using votan's example xml file:
#include <mxml.h>
#include <stdio.h>
#define filename "stuff.xml"
int main()
{
// declare variables
mxml_node_t *rootNode, *childNode;
// try opening the file
FILE
*fp
= fopen(filename
, "r"); // open the xml file
// check if file exists
if(fp == NULL) {
return -1;
}
// load the file into an xml ROOT node
rootNode = mxmlLoadFile(NULL, fp, MXML_OPAQUE_CALLBACK);
// file's loaded, close the handle
// get the first value and print
childNode = mxmlFindElement(rootNode,rootNode,"stuff_test",NULL,NULL,MXML_DESCEND);
if (childNode
) printf("Test1: %s\n", childNode
->child
->value.
opaque);
// get the second value and print
childNode = mxmlFindElement(rootNode,rootNode,"stuff_test2",NULL,NULL,MXML_DESCEND);
if (childNode
) printf("Test2: %s\n", childNode
->child
->value.
opaque);
// Free the xml doc
if (rootNode) mxmlDelete(rootNode);
return 0;
}
Output:
C:\tmp>xmltest2
Test1: This is a test!
Test2: And this is another test!
The xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<stufflist>
<stuff_test>This is a test!</stuff_test>
<stuff_test2>And this is another test!</stuff_test2>
</stufflist>
A.