• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kstars

lilxml.h File Reference


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.

#include <stdio.h>

Include dependency graph for lilxml.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Typedefs

typedef struct _xml_att XMLAtt
typedef struct _xml_ele XMLEle
typedef struct _LilXML LilXML

Functions

LilXML * newLilXML (void)
void delLilXML (LilXML *lp)
void delXMLEle (XMLEle *e)
XMLEle * readXMLEle (LilXML *lp, int c, char errmsg[])
XMLAtt * findXMLAtt (XMLEle *e, const char *name)
XMLEle * findXMLEle (XMLEle *e, const char *tag)
XMLEle * nextXMLEle (XMLEle *ep, int first)
XMLAtt * nextXMLAtt (XMLEle *ep, int first)
XMLEle * parentXMLEle (XMLEle *ep)
XMLEle * parentXMLAtt (XMLAtt *ap)
char * tagXMLEle (XMLEle *ep)
char * pcdataXMLEle (XMLEle *ep)
char * nameXMLAtt (XMLAtt *ap)
char * valuXMLAtt (XMLAtt *ap)
int pcdatalenXMLEle (XMLEle *ep)
int nXMLEle (XMLEle *ep)
int nXMLAtt (XMLEle *ep)
XMLEle * addXMLEle (XMLEle *parent, const char *tag)
void editXMLEle (XMLEle *ep, const char *pcdata)
XMLAtt * addXMLAtt (XMLEle *ep, const char *name, const char *value)
void rmXMLAtt (XMLEle *ep, const char *name)
void editXMLAtt (XMLAtt *ap, const char *str)
char * entityXML (char *str)
const char * findXMLAttValu (XMLEle *ep, const char *name)
XMLEle * readXMLFile (FILE *fp, LilXML *lp, char errmsg[])
void prXMLEle (FILE *fp, XMLEle *e, int level)
int sprXMLEle (char *s, XMLEle *ep, int level)
int sprlXMLEle (XMLEle *ep, int level)
void indi_xmlMalloc (void *(*newmalloc)(size_t size), void *(*newrealloc)(void *ptr, size_t size), void(*newfree)(void *ptr))

Typedef Documentation

typedef struct _LilXML LilXML

Definition at line 72 of file lilxml.h.

typedef struct _xml_att XMLAtt

Definition at line 70 of file lilxml.h.

typedef struct _xml_ele XMLEle

Definition at line 71 of file lilxml.h.

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal