src/xml_types.cpp

См. документацию.
00001 //
00002 // C++ Implementation: xml_types
00003 //
00004 // Description: 
00005 //
00006 //
00007 // Author: yessss <gennadiyesss@mail.ru>, (C) 2007
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 
00013 #include <xml_types.h>
00014 #include <xml_loader.h>
00015 
00016 void XMLCALL string_text_data (void *userData, const XML_Char *s, int len) {
00017 //   printf("string_text_data\n");
00018      XML_Char* c = (XML_Char*)malloc(sizeof(XML_Char)* len + 1);
00019      memcpy(c, s, len);
00020      c[len] = 0;
00021 //   printf("string %i| %s\n", len, c);
00022      xml_loader* th = (xml_loader*)userData;
00023      lstring * str = (lstring *)th->get_parent();
00024      if(str) {
00025 //        printf("got parent\n");
00026           if(str->value == NULL || str->length() == 0) {
00027 //             printf("str->value == NULL\n");
00028                if(str->value == NULL){
00029                     lstring ls(c);
00030                     *str = ls;
00031                }
00032                else
00033                     str->append(c, len);
00034 //             printf("str->value == <%s>\n", str->value);
00035                
00036           } else {
00037 //             printf("str->value != NULL %i <%s>+<%s>, adding string\n", str->length(), str->value, c);
00038                add_string(*str, c, sizeof(XML_Char)* len + 1);
00039           }
00040      } else {
00041 //        printf("got no parent\n");
00042           th->push(instance<typeof(xstring)>());
00043      }
00044 }
00045 
00046 void XMLCALL decimal_text_data (void *userData, const XML_Char *s, int len) {
00047      string_text_data(userData, s, len);
00048 }
00049 
00050 void string_element ( xml_loader *th, const char *name, const char **atts ) {
00051 //   printf("string_element\n");
00052      th->push(string_text_data);
00053      th->push((element_handler)NULL);
00054 }
00055 
00056 void decimal_element ( xml_loader *th, const char *name, const char **atts ) {
00057 //   printf("decimal_element\n");
00058      th->push(decimal_text_data);
00059      th->push((element_handler)NULL);
00060 }
00061 

Документация по XDataServer. Последние изменения: Thu Jul 12 11:49:43 2007. Создано системой  doxygen 1.5.2