Open Forum > Round Table
Missing documentation for XML module
Support:
I'll add it to the wish list. 8)
Try GetProp(NodeHandle, PropName) as the argument structure being passed.
FYI: Save yourself a lot of time and grief by first testing your code (especially when using extension modules) with the command line interpreter (scriba) before using the app server. If it works under scriba, it will work on the app server variation.
Airr:
I know this is an old post, but anyway....
GetProp doesn't seem to be "exported":
--- Code: ---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 }
};
--- End code ---
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:
--- Code: C ---#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) { perror("\""filename"\""); return -1; } // load the file into an xml ROOT node rootNode = mxmlLoadFile(NULL, fp, MXML_OPAQUE_CALLBACK); // file's loaded, close the handle if (fp) fclose(fp); // 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:
--- Code: ---<?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>
--- End code ---
A.
Support:
--- Quote ---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).
--- End quote ---
That's great news Armando. I will be happy to test your new XML extension module when your ready.
Navigation
[0] Message Index
[*] Previous page
Go to full version