kstars
lilxml.h File Reference
A little DOM-style library to handle parsing and processing an XML file. More...
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Typedefs | |
typedef struct _LilXML | LilXML |
typedef struct _xml_att | XMLAtt |
typedef struct _xml_ele | XMLEle |
Functions | |
void | delLilXML (LilXML *lp) |
void | delXMLEle (XMLEle *e) |
XMLAtt * | findXMLAtt (XMLEle *e, const char *name) |
const char * | findXMLAttValu (XMLEle *ep, char *name) |
XMLEle * | findXMLEle (XMLEle *e, const char *tag) |
void | indi_xmlMalloc (void *(*newmalloc)(size_t size), void *(*newrealloc)(void *ptr, size_t size), void(*newfree)(void *ptr)) |
char * | nameXMLAtt (XMLAtt *ap) |
LilXML * | newLilXML (void) |
XMLAtt * | nextXMLAtt (XMLEle *ep, int first) |
XMLEle * | nextXMLEle (XMLEle *ep, int first) |
int | nXMLAtt (XMLEle *ep) |
int | nXMLEle (XMLEle *ep) |
XMLEle * | parentXMLAtt (XMLAtt *ap) |
XMLEle * | parentXMLEle (XMLEle *ep) |
int | pcdatalenXMLEle (XMLEle *ep) |
char * | pcdataXMLEle (XMLEle *ep) |
void | prXMLEle (FILE *fp, XMLEle *e, int level) |
XMLEle * | readXMLEle (LilXML *lp, int c, char errmsg[]) |
XMLEle * | readXMLFile (FILE *fp, LilXML *lp, char errmsg[]) |
char * | tagXMLEle (XMLEle *ep) |
char * | valuXMLAtt (XMLAtt *ap) |
Detailed Description
A little DOM-style library to handle parsing and processing an XML file.
It only handles elements, attributes and pcdata content. <! ... > and <? ... > are silently ignored. pcdata is collected into one string, sans leading whitespace first line.
The following is an example of a cannonical usage for the lilxml library. Initialize a lil xml context and read an XML file in a root element.
#include <lilxml.h> LilXML *lp = newLilXML(); char errmsg[1024]; XMLEle *root, *ep; int c; while ((c = fgetc(stdin)) != EOF) { root = readXMLEle (lp, c, errmsg); if (root) break; if (errmsg[0]) error ("Error: %s\n", errmsg); } // print the tag and pcdata content of each child element within the root for (ep = nextXMLEle (root, 1); ep != NULL; ep = nextXMLEle (root, 0)) printf ("%s: %s\n", tagXMLEle(ep), pcdataXMLEle(ep)); // finished with root element and with lil xml context delXMLEle (root); delLilXML (lp);
Definition in file lilxml.h.
Typedef Documentation