gwenhywfar  5.10.1
xml2db.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Sun Dec 16 2018
3  copyright : (C) 2018 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 
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29 
30 
31 
32 #include "xml2db.h"
33 
34 #include <gwenhywfar/debug.h>
35 #include <gwenhywfar/text.h>
36 #include <gwenhywfar/gwendate.h>
37 #include <gwenhywfar/xmlcmd_gxml_fromdb.h>
38 #include <gwenhywfar/xmlcmd_gxml_todb.h>
39 
40 
41 #include <ctype.h>
42 
43 
44 
45 
46 int GWEN_Xml2Db(GWEN_XMLNODE *xmlNodeDocument,
47  GWEN_XMLNODE *xmlNodeSchema,
48  GWEN_DB_NODE *dbDestination)
49 {
50  GWEN_XMLCOMMANDER *cmd;
51  int rv;
52 
53  cmd=GWEN_XmlCommanderGwenXml_toDb_new(xmlNodeDocument, dbDestination);
54 
55  rv=GWEN_XmlCommander_HandleChildren(cmd, xmlNodeSchema);
57 
58  if (rv<0) {
59  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
60  return rv;
61  }
62 
63  return 0;
64 }
65 
66 
67 
68 int GWEN_XmlFromDb(GWEN_XMLNODE *xmlNodeDestination,
69  GWEN_XMLNODE *xmlNodeSchema,
70  GWEN_DB_NODE *dbSource)
71 {
72  GWEN_XMLCOMMANDER *cmd;
73  int rv;
74 
75  cmd=GWEN_XmlCommanderGwenXml_fromDb_new(xmlNodeDestination, dbSource);
76 
77  rv=GWEN_XmlCommander_HandleChildren(cmd, xmlNodeSchema);
79 
80  if (rv<0) {
81  DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
82  return rv;
83  }
84 
85  return 0;
86 }
87 
88 
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:228
#define GWEN_LOGDOMAIN
Definition: logger.h:35
int GWEN_XmlFromDb(GWEN_XMLNODE *xmlNodeDestination, GWEN_XMLNODE *xmlNodeSchema, GWEN_DB_NODE *dbSource)
Definition: xml2db.c:68
int GWEN_Xml2Db(GWEN_XMLNODE *xmlNodeDocument, GWEN_XMLNODE *xmlNodeSchema, GWEN_DB_NODE *dbDestination)
Definition: xml2db.c:46
void GWEN_XmlCommander_free(GWEN_XMLCOMMANDER *cmd)
Definition: xmlcmd.c:59
GWEN_XMLCOMMANDER * GWEN_XmlCommanderGwenXml_fromDb_new(GWEN_XMLNODE *xmlNodeDestination, GWEN_DB_NODE *dbSource)
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:181
int GWEN_XmlCommander_HandleChildren(GWEN_XMLCOMMANDER *cmd, GWEN_XMLNODE *xmlNode)
Definition: xmlcmd.c:80
struct GWEN__XMLNODE GWEN_XMLNODE
Definition: xml.h:156
GWEN_XMLCOMMANDER * GWEN_XmlCommanderGwenXml_toDb_new(GWEN_XMLNODE *xmlNodeDocument, GWEN_DB_NODE *dbDestination)
struct GWEN_XMLCOMMANDER GWEN_XMLCOMMANDER
Definition: xmlcmd.h:39