• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • 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 #ifdef __cplusplus
00064 extern "C" {
00065 #endif
00066 
00067 /* opaque handle types */
00068 typedef struct _xml_att XMLAtt;
00069 typedef struct _xml_ele XMLEle;
00070 typedef struct _LilXML LilXML;
00071 
00076 
00077 /* creation and destruction functions */
00078 
00082 extern LilXML *newLilXML(void);
00083 
00087 extern void delLilXML (LilXML *lp);
00088 
00092 extern void delXMLEle (XMLEle *e);
00093 
00100 extern XMLEle *readXMLEle (LilXML *lp, int c, char errmsg[]);
00101 
00102 /* search functions */
00108 extern XMLAtt *findXMLAtt (XMLEle *e, const char *name);
00109 
00115 extern XMLEle *findXMLEle (XMLEle *e, const char *tag);
00116 
00117 /* iteration functions */
00123 extern XMLEle *nextXMLEle (XMLEle *ep, int first);
00124 
00130 extern XMLAtt *nextXMLAtt (XMLEle *ep, int first);
00131 
00132 /* tree functions */
00136 extern XMLEle *parentXMLEle (XMLEle *ep);
00137 
00141 extern XMLEle *parentXMLAtt (XMLAtt *ap);
00142 
00143 /* access functions */
00148 extern char *tagXMLEle (XMLEle *ep);
00149 
00154 extern char *pcdataXMLEle (XMLEle *ep);
00155 
00160 extern char *nameXMLAtt (XMLAtt *ap);
00161 
00166 extern char *valuXMLAtt (XMLAtt *ap);
00167 
00172 extern int pcdatalenXMLEle (XMLEle *ep);
00173 
00178 extern int nXMLEle (XMLEle *ep);
00179 
00184 extern int nXMLAtt (XMLEle *ep);
00185 
00186 /* convenience functions */
00192 extern const char *findXMLAttValu (XMLEle *ep, char *name);
00193 
00200 extern XMLEle *readXMLFile (FILE *fp, LilXML *lp, char errmsg[]);
00201 
00207 extern void prXMLEle (FILE *fp, XMLEle *e, int level);
00208 
00209 /* install alternatives to malloc/realloc/free */
00210 extern void indi_xmlMalloc (void *(*newmalloc)(size_t size),
00211     void *(*newrealloc)(void *ptr, size_t size), void (*newfree)(void *ptr));
00212 
00215 #ifdef __cplusplus
00216 }
00217 #endif
00218 
00219 /* examples.
00220 
00221         initialize a lil xml context and read an XML file in a root element
00222 
00223     LilXML *lp = newLilXML();
00224     char errmsg[1024];
00225     XMLEle *root, *ep;
00226     int c;
00227 
00228     while ((c = fgetc(stdin)) != EOF) {
00229         root = readXMLEle (lp, c, errmsg);
00230         if (root)
00231         break;
00232         if (errmsg[0])
00233         error ("Error: %s\n", errmsg);
00234     }
00235  
00236         print the tag and pcdata content of each child element within the root
00237 
00238         for (ep = nextXMLEle (root, 1); ep != NULL; ep = nextXMLEle (root, 0))
00239         printf ("%s: %s\n", tagXMLEle(ep), pcdataXMLEle(ep));
00240 
00241 
00242     finished with root element and with lil xml context
00243 
00244     delXMLEle (root);
00245     delLilXML (lp);
00246  */
00247 
00248 /* For RCS Only -- Do Not Edit
00249  * @(#) $RCSfile$ $Date: 2006-03-09 22:28:31 +0100 (Thu, 09 Mar 2006) $ $Revision: 517084 $ $Name:  $
00250  */
00251 
00252 #endif  /* LILXML_H */

kstars

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

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
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