From Sathiyanarayanan.R at in.flextronics.com Tue Dec 5 15:16:17 2006 From: Sathiyanarayanan.R at in.flextronics.com (Sathiyanarayanan R) Date: Tue, 5 Dec 2006 22:16:17 +0800 Subject: [Expat-discuss] Reg. using Expat for XML-EPG parsing... Message-ID: Hi, Please reply me if you have used Expat for parsing XML based EPG. Regards, Sathiyanarayanan R Senior Designer Software FlexConsumer - Digital Multimedia Flextronics #38, K.H Circle, Hosur Road, Bangalore, India 560 027 +91 80 41869800 tel +91 80 41869801 fax Creating value that increases customer competitiveness CONFIDENTIAL AND PROPRIETARY INFORMATION NOTICE: The information contained in and/or attached to this e-mail is Confidential and Proprietary Information of Flextronics International, Ltd., and its operating companies and subsidiaries. This information is intended only for the confidential use of the person(s) designated above. If this message has reached a person or persons not designated above, you are hereby notified that you have received this document in error and that any review, dissemination, distribution or copying of this message is strictly prohibited. If you are not a designated recipient, please notify Flextronics immediately by reply e-mail and delete the original message together with any and all attachments." Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message From lee at novomail.net Tue Dec 12 17:16:50 2006 From: lee at novomail.net (Lee Passey) Date: Tue, 12 Dec 2006 09:16:50 -0700 Subject: [Expat-discuss] Parsing external entities Message-ID: <457ED5F2.3060202@novomail.net> I need some help parsing external entities. Based on the documentation, I would expect that 1. if I register a ExternalEntityRefHandler, and that 2. if I instantiate an entity parser with XML_ExternalEntityParserCreate, and that 3. if the entity parser successfully parses the external entity file (as indicated by returning XML_STATUS_OK), then whenever an entity is encountered in the XML the replacement value will appear in my CharacterDataHandler; or if the entity has not be parsed by the entity parser the my SkippedEntityHandler will be called. The code does not behave this way. The external entity file is parsed successfully, but my SkippedEntityHandler gets called for /all/ external entities, whether parsed or unparsed, and the parsed data is /never/ passed to the CharacterDataHandler. I can see three possibilities for this behavior: 1. there is a bug in the code, 2. the documentation is incorrect, or 3. there is some undocumented prerequisite that I must do to make it work. Can someone shed some light on how this process is supposed to work and what I must do to parse external entities? -- Nothing of significance below this line. From mark.serlin at ashgaming.com Wed Dec 13 14:41:10 2006 From: mark.serlin at ashgaming.com (Mark Serlin) Date: Wed, 13 Dec 2006 13:41:10 -0000 Subject: [Expat-discuss] junk after document element In-Reply-To: <457ED5F2.3060202@novomail.net> Message-ID: Hi all I'm getting the above error message parsing this: It's a CString by the way, I'm using it like this. XML_Status status = XML_Parse( parser, xmlToParse.GetBuffer( xmlToParse.GetLength() ), xmlToParse.GetLength(), true ); Any ideas anyone? -Mark From rolf at pointsman.de Wed Dec 13 15:26:56 2006 From: rolf at pointsman.de (rolf at pointsman.de) Date: Wed, 13 Dec 2006 15:26:56 +0100 (CET) Subject: [Expat-discuss] junk after document element In-Reply-To: Message-ID: <20061213142659.E69469BBC4@pointsman.pointsman.de> On 13 Dec, Mark Serlin wrote: > I'm getting the above error message parsing this: > hasPlayedBefore="0" /> maxChips="1" minChips="1" validChips="10,25,50,100,200,500,1000,2000" /> > > It's a CString by the way, I'm using it like this. > > XML_Status status = XML_Parse( parser, xmlToParse.GetBuffer( > xmlToParse.GetLength() ), xmlToParse.GetLength(), true ); You've an empty document tag 'Framework'. An XML document has always a single root. Everything else other than whitespace, comments or processing instructions after the closing tag of the document element is junk. rolf From diego at solo10.com Thu Dec 14 01:35:21 2006 From: diego at solo10.com (Diego Angelini) Date: Wed, 13 Dec 2006 21:35:21 -0300 Subject: [Expat-discuss] sample code Message-ID: <45809C49.9010800@solo10.com> Hello, I just installed Expat, I am a newbie. I need a sample C code, using Expat, to parsing the following XML: **** file.xml ***** name1 name2 **** file.xml ***** I tried to run the examples scripts elements.c and outline.c but I had no the desired results. I did not understand so much. Please help. From alanbort at gmail.com Thu Dec 14 15:50:53 2006 From: alanbort at gmail.com (Alan Bort) Date: Thu, 14 Dec 2006 11:50:53 -0300 Subject: [Expat-discuss] how to use it Message-ID: <172762180612140650r52598580qb36595c269aaeb5c@mail.gmail.com> Hi, I am new to expat, and I'm looking for information on how to implement expat. I have not yet found any good starting tutorial and am fighting my way with the reference, although it is very hard. I would appreciate if anyone could point me a good piece of documentation. Thanks in advance Alan Bort.- From bob_rossi at cox.net Thu Dec 14 20:56:28 2006 From: bob_rossi at cox.net (Bob Rossi) Date: Thu, 14 Dec 2006 14:56:28 -0500 Subject: [Expat-discuss] mingw Message-ID: <20061214195628.GB31931@cox.net> Hi, What's the appropriate way to build expat for mingw? Is simply installing the binary good enough? Has anyone done this before? Thanks, Bob Rossi From ali at mental.com Fri Dec 15 12:13:11 2006 From: ali at mental.com (Albrecht Fritzsche) Date: Fri, 15 Dec 2006 12:13:11 +0100 Subject: [Expat-discuss] Expat-discuss Digest, Vol 81, Issue 4 In-Reply-To: References: Message-ID: <45828347.1010501@mental.com> > From: "Alan Bort" > Subject: [Expat-discuss] how to use it > To: expat-discuss at libexpat.org > Message-ID: > <172762180612140650r52598580qb36595c269aaeb5c at mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hi, > > I am new to expat, and I'm looking for information on how to implement > expat. Probably you mean it in a sense of "how to use it"? > I have not yet found any good starting tutorial and am fighting > my way with the reference, although it is very hard. But it cannot be much simpler then the Overview section there which gives you even a complete program, outline.c. Start looking into this section and program should give you a good start. Just compile that very file and run it somwhat like (if the exe name is outline) outline < my_collada.dae Ali From alanbort at gmail.com Fri Dec 15 14:04:29 2006 From: alanbort at gmail.com (Alan Bort) Date: Fri, 15 Dec 2006 10:04:29 -0300 Subject: [Expat-discuss] filling a struct Message-ID: <172762180612150504u407f9cbbi4fd60f4e992160a4@mail.gmail.com> Hi, is there a way to fill a struct automatically with expat? From Sathiyanarayanan.R at in.flextronics.com Tue Dec 26 09:06:18 2006 From: Sathiyanarayanan.R at in.flextronics.com (Sathiyanarayanan R) Date: Tue, 26 Dec 2006 16:06:18 +0800 Subject: [Expat-discuss] eXpat=> Reg. binary file parsing ... Message-ID: Dear All, Please suggest whether eXpat parser can be used for parsing XML binary files. If it can, is there anything to be done with the character encoding? Thanks & Regards, R.Sathiyanarayanan. Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message From alanbort at gmail.com Fri Dec 29 13:15:04 2006 From: alanbort at gmail.com (Alan Bort) Date: Fri, 29 Dec 2006 09:15:04 -0300 Subject: [Expat-discuss] Access Violation Message-ID: <172762180612290415v2234b944pb628a5fabc4e3d99@mail.gmail.com> Hi, I am programming on windows, and this piece of code is giving me an access violation when inicio_h ends. (at least that's how far I was able to track the problem) The Access Violation occurs in the call to XML_Parse(); /*###STRUCTURES###*/ typedef struct _PLAYERDATA { BOOL bEnabled; BOOL bPlayerMe; /* indica que este jugador, ya sea una pc o un humano, pertenece a esta PC */ CHAR cName[13]; /* 0: controlado por el usuario, 1: CPU facil - 4: CPU tramposo, 5: esperar jugadas de la red */ UINT uiMode; /* puntero a una estructura de ficha, esto nos da acceso al linked list de las fichas */ /* NULL si no tenemos informaci?n de las fichas de este jugador, nos basamos luego en uiFichasCount para dibujar la cantidad de fichas del player */ FICHA * fFicha; UINT uiFichasCount; UINT uiScore; int iGuiOrientation; /* indica en que angulo se dibuja a este player en la pantalla, esto se define al crear la jugada */ /* declarar m?s cosas */ } PLAYERDATA; typedef struct _GAMEDATA { BOOL bNetworkGame; BOOL bHostMode; CHAR cPath[MAX_PATH]; PLAYERDATA pdPlayers[4]; UINT uiMaxPoints; UINT uiTimePerTurn; UINT uMe; /* jugador humano */ FICHACOLOCADA * fcFichaCentro; /* uiGameStage indica que tiene que ocurrir en este momento en el juego: 0: valor inicial, esperando configuraci?n de partida 1: inicializar juego, se crean o se leen los XMLs de inicio de juego (depende si es local o network, si es host o client) 2: leer el dato uiCurrentTurn para ver quien debe jugar y hacer algo de acuerdo a que jugador es 3: Juego termin?, pero el puntaje maximo no fue alcanzado, volver a 1 4: juego termin?, y el puntaje m?ximo fue alcanzado. */ UINT uiGameStage; UINT uiCurrentTurn; /* jugada 1, 2, 3, 4, ... */ UINT uQuedanFichas; /* cantidad de fichas que quedan para repartir a los jugadores */ } GAMEDATA; typedef struct { UINT uColor1; //especifica color 1, va seguido al extremo de ultima ficha UINT uColor2; //especifica color 2 UINT uExtremo; //indica el extremo BOOL bDomino; //si ya un jugador canto domino y termino la partida BOOL bRecibio; //si un jugador recibio ficha BOOL bPaso; //si jugador no juega en su turno UINT uNumJugada; //el numero de jugada } JUGADA; /*XML.C CODE*/ void obtener_fichas(char *name) { char buffer[BUFSIZ]; char file[MAX_PATH]; char error[BUFSIZ]; FILE *arch; XML_Parser parser; int done; //static CONFIG config; // struct stat estado; //Rellena el formato fichas-nombrejugador.xml sprintf(file,"%s\\fichas-%s.xml",gpgdJuego->cPath,name); MessageBox(NULL,file,"Error",MB_OK|MB_ICONEXCLAMATION); if((arch = fopen(file,"rb"))==NULL){ MessageBox(NULL,"Error al abrir el archivo de fichas","Error",MB_OK|MB_ICONEXCLAMATION); return; } //Resetea todos los componentes de config //reset_config(&config); reset_gamedata(gpgdJuego); /*Aqui comienza el parseo*/ //Crea un parser con codificacion UTF-8 parser = XML_ParserCreate("UTF-8"); //paso estructura CONFIG al parser, para que las funciones //que procesan tags puedan operar con ella //la reciben en el campo *UserData XML_SetUserData(parser,gpgdJuego); //Funciones que van a procesar el principio y fin de tags> //para el caso de varios atributos en multil?neas XML_SetElementHandler(parser,inicio_h,fin_h); //para el caso de atributos simples en una sola linea XML_SetCharacterDataHandler(parser,char_h); do { size_t len = fread(buffer, 1, sizeof(buffer), arch); done = len < sizeof(buffer); //Verifica si hay error en el xml int o; int p; o = XML_Parse(parser, buffer, len, done); MessageBox(NULL,"Parsed","Parsing",MB_OK); p = (o == XML_STATUS_ERROR); if (p) { sprintf(error,"%s at line %d\n",XML_ErrorString(XML_GetErrorCode(parser)),XML_GetCurrentLineNumber(parser)); MessageBox(NULL,error,"Error:",MB_OK); //modificar esta parte para api return; } }while (!done); fclose(arch); //remove(file); XML_ParserFree(parser); return /*&config*/; } static void inicio_h(void *userData,const XML_Char *name,const XML_Char **atts) { int i = 0; static UINT uColor1; static UINT uColor2; static BOOL bEmpieza; static BOOL bDone; // CONFIG *conf = (CONFIG *)userData; GAMEDATA *juego = (GAMEDATA *)userData; int a; int b; a = lstrcmpi(name,"jugador"); b = lstrcmpi(name,"ficha"); //MessageBox(NULL,name,"CHAU",MB_OK); char c[100]; sprintf(c,"a:%d, b:%d | el or da:%d",a,b,((!a) || (!b))); MessageBox(NULL,c,"Test",MB_OK); //if((!strcmp(name,"jugador"))||(!strcmp(name,"ficha"))){ if ((!a) || (!b)){ //verifica si atributos == NULL, si no entonces //contiene informacion importante MessageBox(NULL,"Hola","CHAU",MB_OK); if (atts == NULL) return; while(atts[i]){ if(!strcmp(atts[i],"numero")){ i++; switch(convertir(atts[i++])){ case 1: strcpy(juego->pdPlayers[0].cName,atts[++i]); break; case 2: strcpy(juego->pdPlayers[1].cName,atts[++i]); break; case 3: strcpy(juego->pdPlayers[2].cName,atts[++i]); break; case 4: strcpy(juego->pdPlayers[3].cName,atts[++i]); break; } i++; }else{ bEmpieza = FALSE; bDone = FALSE; if(!strcmp(atts[i],"color1")){ uColor1 = convertir(atts[++i]); i++; }else if(!strcmp(atts[i],"color2")){ uColor2 = convertir(atts[++i]); i++; }else if(!strcmp(atts[i],"empieza")){ i++; if(!strcmp(atts[i],"si")){ bEmpieza = TRUE; bDone = TRUE; i++; } } if (bDone) AgregarColor(juego->pdPlayers[juego->uMe].fFicha,uColor1,uColor2,bEmpieza); } } } else if(!strcmp(name,"maxtiempo")) gpgdJuego->uiTimePerTurn=1; else if(!strcmp(name,"maxpuntos")) gpgdJuego->uiMaxPoints = 1; MessageBox(NULL,"Parsed","Parsing",MB_OK); return; } static void fin_h(void *userData,const XML_Char *name) { int a=0; a ++; /*if (!strcmp(name,"maxtiempo")) { gpgdJuego->uiTimePerTurn=0; } else if (!strcmp(name,"maxpuntos")) { gpgdJuego->uiMaxPoints=0; } */ return; } static void char_h(void *userData,const XML_Char *s,int len) { int a=0; a ++; /*char buffer[64]; // CONFIG *conf = (CONFIG *)userData; GAMEDATA *gamedata = (GAMEDATA *)userData; strncpy(buffer,s,len); buffer[len] = '\0'; if(gpgdJuego->uiTimePerTurn){ gamedata->uiTimePerTurn = atoi(buffer); }else if(gpgdJuego->uiMaxPoints){ gamedata->uiMaxPoints = atoi(buffer); }*/ return; } it is supposed to parse this file, and the call to obtener_fichas is the following: char tmp_cName[13]; lstrcpy(tmp_cName,gpgdJuego->pdPlayers[0].cName); obtener_fichas(tmp_cName); for (int i = 0; i<4;i++){ if (gpgdJuego->pdPlayers[i].bEnabled){ if (!lstrcmpi(tmp_cName,gpgdJuego->pdPlayers[i].cName)){ gpgdJuego->pdPlayers[i].bPlayerMe = TRUE; gpgdJuego->uMe = i; break; } } } /**FILE**/ 60 100 The Access Violation occurs in the call to XML_Parse();