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

kstars

lilxml.h

Go to the documentation of this file.
00001 #if 0
00002     liblilxml
00003     Copyright (C) 2003 Elwood C. Downey
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #endif
00020 
00060 #ifndef LILXML_H
00061 #define LILXML_H
00062 
00063 #include <stdio.h>
00064 
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068 
00069 /* opaque handle types */
00070 typedef struct _xml_att XMLAtt;
00071 typedef struct _xml_ele XMLEle;
00072 typedef struct _LilXML LilXML;
00073 
00078 
00079 /* creation and destruction functions */
00080 
00084 extern LilXML *newLilXML(void);
00085 
00089 extern void delLilXML (LilXML *lp);
00090 
00094 extern void delXMLEle (XMLEle *e);
00095 
00102 extern XMLEle *readXMLEle (LilXML *lp, int c, char errmsg[]);
00103 
00104 /* search functions */
00110 extern XMLAtt *findXMLAtt (XMLEle *e, const char *name);
00111 
00117 extern XMLEle *findXMLEle (XMLEle *e, const char *tag);
00118 
00119 /* iteration functions */
00125 extern XMLEle *nextXMLEle (XMLEle *ep, int first);
00126 
00132 extern XMLAtt *nextXMLAtt (XMLEle *ep, int first);
00133 
00134 /* tree functions */
00138 extern XMLEle *parentXMLEle (XMLEle *ep);
00139 
00143 extern XMLEle *parentXMLAtt (XMLAtt *ap);
00144 
00145 /* access functions */
00150 extern char *tagXMLEle (XMLEle *ep);
00151 
00156 extern char *pcdataXMLEle (XMLEle *ep);
00157 
00162 extern char *nameXMLAtt (XMLAtt *ap);
00163 
00168 extern char *valuXMLAtt (XMLAtt *ap);
00169 
00174 extern int pcdatalenXMLEle (XMLEle *ep);
00175 
00180 extern int nXMLEle (XMLEle *ep);
00181 
00186 extern int nXMLAtt (XMLEle *ep);
00187 
00188 /* editing functions */
00192 extern XMLEle *addXMLEle (XMLEle *parent, const char *tag);
00193 
00198 extern void editXMLEle (XMLEle *ep, const char *pcdata);
00199 
00205 extern XMLAtt* addXMLAtt (XMLEle *ep, const char *name, const char *value);
00206 
00211 extern void rmXMLAtt (XMLEle *ep, const char *name);
00212 
00217 extern void editXMLAtt (XMLAtt *ap, const char *str);
00218 
00222 extern char *entityXML (char *str);
00223 
00224 /* convenience functions */
00230 extern const char *findXMLAttValu (XMLEle *ep, const char *name);
00231 
00238 extern XMLEle *readXMLFile (FILE *fp, LilXML *lp, char errmsg[]);
00239 
00245 extern void prXMLEle (FILE *fp, XMLEle *e, int level);
00246 
00252 extern int sprXMLEle (char *s, XMLEle *ep, int level);
00253 
00257 extern int sprlXMLEle (XMLEle *ep, int level);
00258 
00259 /* install alternatives to malloc/realloc/free */
00260 extern void indi_xmlMalloc (void *(*newmalloc)(size_t size),
00261     void *(*newrealloc)(void *ptr, size_t size), void (*newfree)(void *ptr));
00262 
00265 #ifdef __cplusplus
00266 }
00267 #endif
00268 
00269 /* examples.
00270 
00271         initialize a lil xml context and read an XML file in a root element
00272 
00273     LilXML *lp = newLilXML();
00274     char errmsg[1024];
00275     XMLEle *root, *ep;
00276     int c;
00277 
00278     while ((c = fgetc(stdin)) != EOF) {
00279         root = readXMLEle (lp, c, errmsg);
00280         if (root)
00281         break;
00282         if (errmsg[0])
00283         error ("Error: %s\n", errmsg);
00284     }
00285  
00286         print the tag and pcdata content of each child element within the root
00287 
00288         for (ep = nextXMLEle (root, 1); ep != NULL; ep = nextXMLEle (root, 0))
00289         printf ("%s: %s\n", tagXMLEle(ep), pcdataXMLEle(ep));
00290 
00291 
00292     finished with root element and with lil xml context
00293 
00294     delXMLEle (root);
00295     delLilXML (lp);
00296  */
00297 
00298 /* For RCS Only -- Do Not Edit
00299  * @(#) $RCSfile$ $Date: 2007-09-17 15:34:48 +0200 (Mon, 17 Sep 2007) $ $Revision: 713418 $ $Name:  $
00300  */
00301 
00302 #endif  /* 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
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
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