gwenhywfar  4.11.0beta
xml.h
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Sat Jun 28 2003
3  copyright : (C) 2003-2010 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU Lesser General Public *
10  * License as published by the Free Software Foundation; either *
11  * version 2.1 of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * Lesser General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Lesser General Public *
19  * License along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  * *
23  ***************************************************************************/
24 
25 #ifndef GWENHYWFAR_XML_H
26 #define GWENHYWFAR_XML_H
27 
29 #include <gwenhywfar/stringlist.h>
30 #include <gwenhywfar/types.h>
31 #include <gwenhywfar/list2.h>
32 #include <gwenhywfar/syncio.h>
33 
34 #include <stdio.h>
35 
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
46 
51 
52 
56 
60 #define GWEN_XML_FLAGS_HANDLE_COMMENTS 0x0001
61 
66 #define GWEN_XML_FLAGS_INDENT 0x0002
67 
73 #define GWEN_XML_FLAGS_HANDLE_OPEN_HTMLTAGS 0x0004
74 
79 #define GWEN_XML_FLAGS_NO_CONDENSE 0x0008
80 
85 #define GWEN_XML_FLAGS_KEEP_CNTRL 0x0010
86 
87 #define GWEN_XML_FLAGS_KEEP_BLANKS 0x0020
88 
89 #define GWEN_XML_FLAGS_SIMPLE 0x0040
90 
94 #define GWEN_XML_FLAGS_HANDLE_HEADERS 0x0080
95 
103 #define GWEN_XML_FLAGS_TOLERANT_ENDTAGS 0x0100
104 
105 #define GWEN_XML_FLAGS_HANDLE_NAMESPACES 0x0200
106 
110 #define GWEN_XML_FLAGS_DEFAULT \
111  (\
112  GWEN_XML_FLAGS_INDENT | \
113  GWEN_XML_FLAGS_HANDLE_COMMENTS\
114  )
115 
124 
125 #define GWEN_XML_PATH_FLAGS_OVERWRITE_VALUES 0x00010000
126 
134 typedef enum {
143 
147 typedef struct GWEN__XMLNODE GWEN_XMLNODE;
149 
152 
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 
160 #include <gwenhywfar/xmlctx.h>
161 #include <gwenhywfar/fastbuffer.h>
162 
163 
164 #ifdef __cplusplus
165 extern "C" {
166 #endif
167 
168 
169 
175 GWEN_XMLNODE *GWEN_XMLNode_new(GWEN_XMLNODE_TYPE t, const char *data);
176 
182 
190 
196 
220 
227 
233 
240 
247 
272  const char *GWEN_XMLNode_GetProperty(const GWEN_XMLNODE *n,
273  const char *name,
274  const char *defaultValue);
275 
285  const char *name,
286  const char *value);
287 
293 int GWEN_XMLNode_GetIntProperty(const GWEN_XMLNODE *n, const char *name,
294  int defaultValue);
295 
301  const char *name, int value);
302 
314  const GWEN_XMLNODE *sn,
315  int overwrite);
325 
328 const char *GWEN_XMLNode_GetData(const GWEN_XMLNODE *n);
329 
333 void GWEN_XMLNode_SetData(GWEN_XMLNODE *n, const char *data);
334 
336 const char *GWEN_XMLNode_GetNamespace(const GWEN_XMLNODE *n);
337 
339 void GWEN_XMLNode_SetNamespace(GWEN_XMLNODE *n, const char *s);
340 
360 
363 
365  uint32_t GWEN_XMLNode_GetUsage(const GWEN_XMLNODE *n);
384 
394 
399 
410 
424 
434 
448 
476  const char *tname,
477  const char *pname,
478  const char *pvalue);
479 
487  const char *tname,
488  const char *pname,
489  const char *pvalue);
490 
496 int GWEN_XMLNode_IsChildOf(const GWEN_XMLNODE *parent,
497  const GWEN_XMLNODE *child);
498 
500 int GWEN_XMLNode_GetXPath(const GWEN_XMLNODE *n1,
501  const GWEN_XMLNODE *n2,
502  GWEN_BUFFER *nbuf);
503 
518  const char *path,
519  uint32_t flags);
520 
521 
529 
540 
550 
556 
569  int copythem);
570 
579  const char *data);
587 
594 
595 
596 
599 
600 
603 
604 
608  uint32_t *pLastId);
609 
610 
613 
619 
621 int GWEN_XMLContext_ReadFromFile(GWEN_XML_CONTEXT *ctx, const char *fname);
622 
624 int GWEN_XMLContext_ReadFromString(GWEN_XML_CONTEXT *ctx, const char *text);
625 
626 
632 int GWEN_XML_ReadFile(GWEN_XMLNODE *n, const char *filepath, uint32_t flags);
633 
636  int len,
637  uint32_t flags);
638 
644  GWEN_XML_CONTEXT *ctx,
645  GWEN_SYNCIO *sio);
646 
652  const char *fname,
653  uint32_t flags);
654 
656 int GWEN_XMLNode_toBuffer(const GWEN_XMLNODE *n, GWEN_BUFFER *buf, uint32_t flags);
657 
658 
659 
660 
663 
666  const char *s);
667 
670  const char *s);
671 
674 
675 
676 
704 
711 const char *GWEN_XMLNode_GetCharValue(const GWEN_XMLNODE *n,
712  const char *name,
713  const char *defValue);
714 
717  const char *name,
718  const char *value);
719 
734  const char *name,
735  const char *defValue);
736 
746  const char *name,
747  int defValue);
748 
751  const char *name,
752  int value);
753 
781 
790  const char *path,
791  const char *defValue);
792 
794 int GWEN_XMLNode_SetCharValueByPath(GWEN_XMLNODE *n, uint32_t flags,
795  const char *name,
796  const char *value);
797 
806  const char *name,
807  int defValue);
808 
810 int GWEN_XMLNode_SetIntValueByPath(GWEN_XMLNODE *n, uint32_t flags,
811  const char *name,
812  int value);
813 
822 
827 void GWEN_XMLNode_Dump(const GWEN_XMLNODE *n, int ind);
830  /* defgroup */
831 
832 
840 
842 
843 
850 
856  GWEN_XMLNODE *n);
857 
864 
869 void GWEN_XMLNode_Path_Dump(GWEN_XMLNODE_PATH *np); /* defgroup */ /* defgroup (all)*/
872 
873 
874 
877  const char *url);
878 
881 
884 
887 
890 
891 
892 #ifdef __cplusplus
893 }
894 #endif
895 
896 
897 
898 #endif