Changeset 3427

Show
Ignore:
Timestamp:
07/10/08 08:52:23 (2 months ago)
Author:
bricks
Message:

Added OSyncXMLFormatSchema to get rid of osxml api. See Ticket #753

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/opensync/CMakeLists.txt

    r3426 r3427  
    5858   xmlformat/opensync_xmlfieldlist.c 
    5959   xmlformat/opensync_xmlformat.c 
     60   xmlformat/opensync_xmlformat_schema.c 
    6061) 
    6162 
     
    127128) 
    128129ADD_EXECUTABLE( osplugin ${osplugin_SRCS} ) 
     130 
     131IF(COMMAND cmake_policy) 
     132  cmake_policy(SET CMP0005 OLD) 
     133ENDIF(COMMAND cmake_policy) 
     134 
    129135ADD_DEFINITIONS( -DOSPLUGIN="\\\"${OPENSYNC_LIBEXEC_DIR}/osplugin\\\"" ) 
    130136 
  • trunk/opensync/opensync-xmlformat.h

    r3366 r3427  
    2525 
    2626#include "xmlformat/opensync_xmlformat.h" 
     27#include "xmlformat/opensync_xmlformat_schema.h" 
    2728#include "xmlformat/opensync_xmlfield.h" 
    2829#include "xmlformat/opensync_xmlfieldlist.h" 
  • trunk/opensync/opensync.h

    r3311 r3427  
    178178typedef struct OSyncCapability OSyncCapability; 
    179179typedef struct OSyncXMLFormat OSyncXMLFormat; 
     180typedef struct OSyncXMLFormatSchema OSyncXMLFormatSchema; 
    180181typedef struct OSyncXMLField OSyncXMLField; 
    181182typedef struct OSyncXMLFieldList OSyncXMLFieldList; 
  • trunk/opensync/xmlformat/opensync-xmlformat_internals.h

    r3368 r3427  
    2727 
    2828#include "opensync_xmlformat_internals.h" 
     29#include "opensync_xmlformat_schema_internals.h" 
    2930#include "opensync_xmlfield_internals.h" 
    3031#include "opensync_xmlfieldlist_internals.h" 
  • trunk/opensync/xmlformat/opensync_xmlformat.c

    r3365 r3427  
    9090        osync_trace(TRACE_EXIT, "%s: %i", __func__, p); 
    9191        return p; 
    92 } 
    93  
    94 /** 
    95  * @brief Validate the xmlformat against its schema in inidivual path 
    96  * @param xmlformat The pointer to a xmlformat object  
    97  * @param path The individual schema path. If NULL the default OPENSYNC_SCHEMASDIR is used. 
    98  * @return TRUE if xmlformat valid else FALSE 
    99  */ 
    100 osync_bool _osync_xmlformat_validate(OSyncXMLFormat *xmlformat, const char *path) 
    101 { 
    102         osync_assert(xmlformat); 
    103          
    104         char *schemafilepath = g_strdup_printf("%s%c%s%s%s", 
    105                 path ? path : OPENSYNC_SCHEMASDIR, 
    106                 G_DIR_SEPARATOR, 
    107                 "xmlformat-", 
    108                 osync_xmlformat_get_objtype(xmlformat), 
    109                 ".xsd"); 
    110         osync_bool res = osync_xml_validate_document(xmlformat->doc, schemafilepath); 
    111         g_free(schemafilepath); 
    112          
    113         return res; 
    11492} 
    11593 
     
    395373 * @brief Validate the xmlformat against its schema 
    396374 * @param xmlformat The pointer to a xmlformat object  
     375 * @param error The error which will hold the info in case of an error 
    397376 * @return TRUE if xmlformat valid else FALSE 
    398377 */ 
    399 osync_bool osync_xmlformat_validate(OSyncXMLFormat *xmlformat) 
    400 
    401         osync_assert(xmlformat); 
    402  
    403         return _osync_xmlformat_validate(xmlformat, NULL); 
     378osync_bool osync_xmlformat_validate(OSyncXMLFormat *xmlformat, OSyncError **error) 
     379
     380        osync_assert(xmlformat); 
     381         
     382        OSyncXMLFormatSchema * schema = osync_xmlformat_schema_get_instance(xmlformat, error); 
     383        return osync_xmlformat_schema_validate(schema, xmlformat, error); 
    404384} 
    405385 
  • trunk/opensync/xmlformat/opensync_xmlformat.h

    r3365 r3427  
    4949 
    5050OSYNC_EXPORT osync_bool osync_xmlformat_assemble(OSyncXMLFormat *xmlformat, char **buffer, unsigned int *size); 
    51 OSYNC_EXPORT osync_bool osync_xmlformat_validate(OSyncXMLFormat *xmlformat); 
     51OSYNC_EXPORT osync_bool osync_xmlformat_validate(OSyncXMLFormat *xmlformat, OSyncError **error); 
    5252 
    5353OSYNC_EXPORT void osync_xmlformat_sort(OSyncXMLFormat *xmlformat); 
  • trunk/opensync/xmlformat/opensync_xmlformat_internals.h

    r3365 r3427  
    2424#define OPENSYNC_XMLFORMAT_INTERNALS_H_ 
    2525 
    26 #include <opensync/opensync_xml.h> 
    2726 
    2827/**  
     
    4746 
    4847int _osync_xmlformat_get_points(OSyncXMLPoints points[], int* cur_pos, int basic_points, const char* fieldname); 
    49 osync_bool _osync_xmlformat_validate(OSyncXMLFormat *xmlformat, const char *path); 
     48 
    5049 
    5150#endif /*OPENSYNC_XMLFORMAT_INTERNAL_H_*/