1

j'aimerais utiliser la librarie tinyXML
Elle permet de lire et d'écrire des fichiers xml
(http://sourceforge.net/projects/tinyxml)
mais je ne sais pas comment m'y prendre pour en compiler les sources :/
quelqu'un a t'il déja utilisé cette libraire pour un projet gp2x et pourrait me fournir les fichiers de la librarie ?

Merci d'avance !

2

je ne c pas pour tinyXml mais tu peut utiliser mon code si tu veut smile

le code est libre pour un usage non commercial
} } xml.cpp #include "xml.h" u32     xml::loadXmlFile(char * path) {     xmlFile = (char*)loadFile(path,&fileSize);      wasloadfromDisc=1; offset=xmlFile;      return !(xmlFile==0); } u32 xml::memLoadXml(char * xml, u32 fileSize) {     xmlFile = xml; this->fileSize = fileSize ;      wasloadfromDisc=0; offset=xmlFile;      return !(xmlFile==0 || fileSize==0); } void xml::freeClass(void) {     if(wasloadfromDisc && xmlFile) free(xmlFile);      if(wordPath) free(wordPath); } xml::xml(char * fileOrPath,u32 memsize) {     xml();      wordPath = (char*)malloc(2048);      workBf = &(wordPath[1024]);      *wordPath = *workBf = 0 ;      xmlFile = 0 ;      log(0,"xml.log");      printlr("wordPath 0x%x\nworkBf 0x%x",wordPath,workBf);      if(isAPath(fileOrPath))     loadXmlFile(fileOrPath);           else                    memLoadXml(fileOrPath,memsize);      printlr("optional constructor finished.\nxmlFile : 0x%x\nxml size : %i",xmlFile,fileSize);      printlr("wordPath 0x%x\nworkBf 0x%x",wordPath,workBf); } xml::xml(void) {     wordPath = (char*)malloc(2048);      workBf = &(wordPath[1024]);      *wordPath = *workBf = 0 ;      xmlFile = 0 ;      log(0,"xml.log");      log("default constructor finished.");      printlr("wordPath 0x%x\nworkBf 0x%x",wordPath,workBf); } xml::~xml(void) {     freeClass(); } char * xml::getCurrentWordPath(void) {     return wordPath ; } void xml::scanAllFile     (     void     (*onAWord)(char *word),                                    void     (*onAnArgument)(char *arg,char*value)                               ) {     u32 type ;      if(!xmlFile) return ;      printlr("enter scanAllFile\n");      do{ type = jumpToNext();           switch(type)                {     case 0 : printlr("\n..eof .."); break;                     case 1 :     printlr("<%s>",workBf);                                    if(onAWord) onAWord(workBf);                          break;                     case 2 : u32 n = 0 ;                                while(workBf[n++]);                                char * p = &(workBf[n]);                                printlr("argument find : [%s][%s]",p,workBf);                                if(onAnArgument) onAnArgument(p,workBf);                     break;                };      } while(type); } u32 xml::jumpToNext(void) {     char * w = offset; u32 n=0;      char * fileEnd = (xml::xmlFile) + (xml::fileSize) ;      while(1)           switch(*w)           {      // start of a balise                case '<' :                     //printlr("start of balise.");                     switch(w[1])                     {     case '/' : // in fact it was a balise end                          case '\':                               //printlr("in fact it's a end");                               // search if we skip a value..                               {     char * p = w-1 ;                                    while(*p != '=' && *p != '>' && *p != ' ' && *p != '\n') p-- ;                                    if(*p == '>') // we was skip this value !                                    {     //printlr("we skip value");                                         p++ ; u32 n=0;                                         while(*p != '>') { workBf[n++]=*p++; workBf[n]=0; } w++; // set value                                         p = &(w[2]); n++ ; char * z = &(workBf[n]);                                         while(*p != '>') { workBf[n++]=*p++; workBf[n]=0; } w++; // and arg name                                         offset=w;                                         //printlr("arg : %s.%s",workBf,z);                                         {     n = strlen(wordPath);                                              char * p = wordPath + n ;                                              while(p > wordPath && *p != '\') p-- ; *p=0 ;                                              return 2; // return find an argument !                                         }                                    }                               }                               {     n = strlen(wordPath);                                    char * p = wordPath + n ;                                    while(p > wordPath && *p != '\') p-- ; *p=0 ; w++; offset=w;                               }                          break;                          default: // default: it's really a start, it's the balise name                               //printlr("it's a start");                               w++; n=0;                                                               while(*w != ' ' && *w != '>')                                    {     //printl("%c",*w);                                         workBf[n] = *w;                                         n++ ; w++ ;                                         workBf[n]=0;                                    };                               //printlr("");                               w++; offset=w;                               //printlr("name %s",workBf);                               sprintf(wordPath,"%s\%s",wordPath,workBf);                               return 1 ;                          break;                     };                break;                 // end of a balise                case '/':                case '\':                     //printlr("end of balise");                     switch(w[1])                     {     case '>' : // last balise end                               {     w+=2; offset=w;                                    n = strlen(wordPath);                                    char * p = wordPath + n ;                                    while(p > wordPath && *p != '\') p-- ; *p=0 ;                               }                          break;                          default:                               while(*w++ != '>'); offset=w;                               {     n = strlen(wordPath);                                    char * p = wordPath + n ;                                    while(p > wordPath && *p != '\') p-- ; *p=0 ;                               }                          break;                     };                break;                                 // value of an argument                case '=' :                //     printlr("\nargument find");                     {     char * p = w+1 ; n=0;                          while(*p != '>' && *p != ' ' && *p != '/' && *p != '\') { workBf[n++]=*p++; workBf[n]=0; }                          offset = p ; w = p ;                          while(*--p != '='); while(*--p != ' '); p++; n++; char * nm = &(workBf[n]);                          while(*p != '=') { workBf[n++]=*p++; workBf[n]=0; }                          //printlr("  name %s value %s",nm,workBf);                          return 2; // return find an argument !                     }                break;                 // space or text is skipped                default : offset = w ; /*printl("%c",*w);*/ w++; if(offset>=fileEnd) return 0; break;            d); }; xml.h #include "../Gdl/Gdl.h" class xml {     private:       char *  xmlFile;        u32      fileSize;        u32      wasloadfromDisc;       char *  wordPath, *workBf;       char *      offset ;       u32      jumpToNext(void);      public:       u32     memLoadXml(char * xml, u32 fileSize);       u32     loadXmlFile(char * path);       void     scanAllFile     (     void     (*onAWord)(char *word)=0,                                    void     (*onAnArgument)(char *arg,char*value)=0                               );              char * getCurrentWordPath(void);       void     freeClass(void);        xml(void);        xml(char * fileOrPath, u32 memSize=0);       ~xml(voi

tu aura besoin de la fonction loadFile
unsigned char * loadFile(const char *path, u32*size)
{ FILE *f ; int sz ; unsigned char * fl ;
f = fopen(path,readb) ;
if(!f) { if(size) *size=0; return 0; }
else { sz = getSize(f) ;
if(size) *size=sz;
}
fl = (unsigned char*)malloc(sz) ;
fread(fl,sz,1,f) ; fclose(f) ;
return fl ; }


attention, le format n'est pas entierement supporte tu devra faire des test pour voir ce qui passe (la g pas de fichiers d'exemple)
et la le mec il le pécho par le bras et il lui dit '

3

Je te remercie, je me plongerai dans ton code des que j'aurai un peu de temps libre a moi !

4

oula!

de nompbreaux messages d'erreurs lors de lacompilation!
exemples:
27 C:\pikix\main.c `readb' undeclared (first use this function)
29 C:\pikix\main.c `getSize' undeclared (first use this function)
40 C:\pikix\xml.cpp `log' undeclared (first use this function)
1 C:\pikix\xml.h ../Gdl/Gdl.h: No such file or directory.
...

ton code necéssite une libraire que je n'ai pas ?

5

non, c que ce code est un bout de ma lib et utilise qq fonctions et define de celle ci ^^

je v voir pour netoyer un peu tout ca
et la le mec il le pécho par le bras et il lui dit '