#include <stdio.h>
#include <glib.h>
#include "erreglog.h"
#include "erreg.h"
#include "erregxsd.h"
#include "erregxml.h"
#include "erregtypes_f.h"
Go to the source code of this file.
Functions | |
gboolean | xsdLoad (regSchema_t *pXsdCxt, const char *szXsdFile) |
void | xsdUnload (regSchema_t *pXsdCxt) |
gboolean | xsdValidateXmlDoc (regSchema_t *pXsdCxt, xmlDocPtr pDoc) |
Copyright (C) 2007 iRex Technologies B.V. All rights reserved.
Definition in file erregxsd.c.
gboolean xsdLoad | ( | regSchema_t * | pXsdCxt, | |
const char * | szXsdFile | |||
) |
Definition at line 37 of file erregxsd.c.
00038 { 00039 ERREG_XSD_LOGPRINTF("entry %p %s", pXsdCxt, szXsdFile); 00040 00041 if (NULL == pXsdCxt || NULL == szXsdFile) 00042 { 00043 ERREG_XSD_ERRORPRINTF("invalid arguments"); 00044 return FALSE; 00045 } 00046 00047 pXsdCxt->pDoc = xmlParseFile(szXsdFile); 00048 if (pXsdCxt->pDoc) 00049 { 00050 pXsdCxt->pParser = xmlSchemaNewDocParserCtxt(pXsdCxt->pDoc); 00051 if (pXsdCxt->pParser) 00052 { 00053 pXsdCxt->pCxt = xmlSchemaParse(pXsdCxt->pParser); 00054 if (pXsdCxt->pCxt) 00055 { 00056 pXsdCxt->pValid = xmlSchemaNewValidCtxt(pXsdCxt->pCxt); 00057 if (pXsdCxt->pValid) 00058 { 00059 pXsdCxt->szFileName = g_strdup(szXsdFile); 00060 return TRUE; 00061 } 00062 } 00063 } 00064 } 00065 00066 xsdUnload(pXsdCxt); 00067 return FALSE; 00068 }
void xsdUnload | ( | regSchema_t * | pXsdCxt | ) |
Definition at line 70 of file erregxsd.c.
00071 { 00072 ERREG_XSD_LOGPRINTF("entry %p", pXsdCxt); 00073 00074 if (pXsdCxt) 00075 { 00076 if (pXsdCxt->pDoc) 00077 { 00078 xmlFreeDoc(pXsdCxt->pDoc); 00079 pXsdCxt->pDoc = NULL; 00080 } 00081 00082 if (pXsdCxt->pParser) 00083 { 00084 xmlSchemaFreeParserCtxt(pXsdCxt->pParser); 00085 pXsdCxt->pParser = NULL; 00086 } 00087 00088 if (pXsdCxt->pCxt) 00089 { 00090 xmlSchemaFree(pXsdCxt->pCxt); 00091 pXsdCxt->pCxt = NULL; 00092 } 00093 00094 if (pXsdCxt->pValid) 00095 { 00096 xmlSchemaFreeValidCtxt(pXsdCxt->pValid); 00097 pXsdCxt->pValid = NULL; 00098 } 00099 00100 if (pXsdCxt->szFileName) 00101 { 00102 g_free(pXsdCxt->szFileName); 00103 pXsdCxt->szFileName = NULL; 00104 } 00105 } 00106 }
gboolean xsdValidateXmlDoc | ( | regSchema_t * | pXsdCxt, | |
xmlDocPtr | pDoc | |||
) |
Definition at line 108 of file erregxsd.c.
00109 { 00110 gboolean bRet = FALSE; 00111 00112 ERREG_XSD_LOGPRINTF("entry %p %p", pXsdCxt, pDoc); 00113 00114 if (pXsdCxt && pXsdCxt->pValid && pDoc) 00115 { 00116 int nRet = xmlSchemaValidateDoc(pXsdCxt->pValid, pDoc); 00117 if (0 == nRet) 00118 { 00119 bRet = TRUE; 00120 } 00121 } 00122 ERREG_XSD_LOGPRINTF("Returns [%d]", bRet); 00123 return bRet; 00124 }