From rodrigo_mora at sympatico.ca Wed Jul 6 22:32:20 2005 From: rodrigo_mora at sympatico.ca (rodrigo_mora@sympatico.ca) Date: Wed, 6 Jul 2005 16:32:20 -0400 Subject: [Expat-discuss] How the attributes of "userdata" are altered with every handler function call? Message-ID: <20050706203747.GZT2134.tomts48-srv.bellnexxia.net@[209.226.175.82]> Hello, I have built a C Struc to keep track of the elements and attributes that the handler functions read. I make the explicit cast from "void* data* to my C Struc. In the first pass, the attributes are stored correctly in the C Struct. However, every time the handlers are called, the C Struct attributes (that were initially stored correctly) change. In other words, every time the handlers are called they override part of the information that has been stored (but not through the program logic). Is like the "void* user data" argument is corrupted with each handler function call. I have been trapped with this problem for a week. Does anybody have an idea of why this is happening? Thank you in advance for your help! -Rodrigo From reid at x10sys.com Thu Jul 7 01:50:51 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 06 Jul 2005 16:50:51 -0700 Subject: [Expat-discuss] How the attributes of "userdata" are altered with every handler function call? In-Reply-To: <20050706203747.GZT2134.tomts48-srv.bellnexxia.net@[209.226.175.82]> References: <20050706203747.GZT2134.tomts48-srv.bellnexxia.net@[209.226.175.82]> Message-ID: <1120693851.725.24.camel@bashful.x10sys.com> This sounds like a general "C" programming issue and not relevant to this list. However, since you're trying to use the expat interface, here's some things to think about: 1. Did you allocate the C struct on the stack or on the heap? If on the stack, it could be corrupted. 2. Did you call XML_SetUserData with the correct value in the second argument? 3. How are you doing the cast? Any chance the address might change during the cast? Which compiler is it? If you're using a modern compiler or C++ you need to use reinterpret_cast(user_data). Reid. On Wed, 2005-07-06 at 16:32 -0400, rodrigo_mora at sympatico.ca wrote: > Hello, > > I have built a C Struc to keep track of the elements and attributes that the handler functions read. I make the explicit cast from "void* data* to my C Struc. In the first pass, > the attributes are stored correctly in the C Struct. However, every time the handlers are called, the C Struct attributes (that were initially stored correctly) change. > > In other words, every time the handlers are called they override part of the information that has been stored (but not through the program logic). Is like the "void* user data" argument is corrupted with each handler function call. > > I have been trapped with this problem for a week. Does anybody have an idea of why this is happening? > > Thank you in advance for your help! > -Rodrigo > > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss at libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://mail.libexpat.org/pipermail/expat-discuss/attachments/20050706/38ff4cd7/attachment.pgp From brian_bisaillon at rogers.com Thu Jul 7 06:42:24 2005 From: brian_bisaillon at rogers.com (Brian Bisaillon) Date: Thu, 7 Jul 2005 00:42:24 -0400 (EDT) Subject: [Expat-discuss] XML_ParseBuffer keeps returning 4 bytes? Message-ID: <20050707044224.3148.qmail@web88006.mail.re2.yahoo.com> Hello, I am new to using expat and I am basically using it for parsing XML configuration files. I configured, compiled and installed the latest version of expat (development version) on Cygwin. I tried to use XML_GetBuffer but whenever I pass it a len, it seems to always return 4 bytes. I found this out after printing a sizeof(buf) after the call to XML_GetBuffer. As a result, read() was only reading the first 4 bytes of my XML configuration file and after that XML_ParseBuffer seemed to do absolutely nothing. I did not get a printout of the XML configuration file. However, when I commented out my call to XML_GetBuffer and changed my call from XML_ParseBuffer to XML_Parse using my own char buffer with a length of 8192, I got the expected results. Now, I am wondering if I did something wrong or if XML_GetBuffer is broken in this release. As I mentioned earlier, I am using Cygwin and have not tested the same code on Linux. I am waiting for my new machine to come in. I did not try it with the previous stable version of expat either. I basically just overwrote the existing expat on Cygwin. Although, maybe I should remove it, reinstall the development version of expat and try again? I doubt this would cause the problem though. Brian. From m_biswas at mailinator.com Thu Jul 7 16:32:17 2005 From: m_biswas at mailinator.com (Mohun Biswas) Date: Thu, 07 Jul 2005 10:32:17 -0400 Subject: [Expat-discuss] how to use XML_StopParser from within a handler? Message-ID: Hi, I've looked in reference.html and the mailing list but can't find an answer to this basic question. My application traverses an XML document until it finds what it's looking for, at which point it's done. I.e. there's no point continuing to parse once that's been found, and the section it's looking for can occur anywhere in the document. I could just set a flag and abandon parsing the next time XML_Parse() returns but according to the API it seems like XML_StopParser (with resumable=0) is the "right" thing to do, presumably followed by XML_ParserFree once XML_Parse returns. The doc for XML_StopParser says it should be invoked from a callback handler. But its signature indicates it takes a pointer to the parser object and that object is not presented to the handler. So how am I to use XML_StopParser from within a callback? Must I make the parser object static? Thanks, MB From m_biswas at mailinator.com Thu Jul 7 16:42:46 2005 From: m_biswas at mailinator.com (Mohun Biswas) Date: Thu, 07 Jul 2005 10:42:46 -0400 Subject: [Expat-discuss] XML_ParseBuffer keeps returning 4 bytes? In-Reply-To: <20050707044224.3148.qmail@web88006.mail.re2.yahoo.com> References: <20050707044224.3148.qmail@web88006.mail.re2.yahoo.com> Message-ID: It sounds like you're confusing the size of the pointer with the size of the buffer it points to. The size of a *pointer* will almost always be 4 bytes. The size of the area it points at is whatever you allocate. You didn't post code but consider the sample code in reference.html: for (;;) { int bytes_read; void *buff = XML_GetBuffer(p, BUFF_SIZE); if (buff == NULL) { /* handle error */ } bytes_read = read(docfd, buff, BUFF_SIZE); if (bytes_read < 0) { /* handle error */ } if (! XML_ParseBuffer(p, bytes_read, bytes_read == 0)) { /* handle parse error */ } if (bytes_read == 0) break; } Sounds like you're using sizeof(buff) in the read() call rather than BUFF_SIZE. MB From Greg.Martin at TELUS.COM Thu Jul 7 17:31:09 2005 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Thu, 7 Jul 2005 08:31:09 -0700 Subject: [Expat-discuss] How the attributes of "userdata" are altered withevery handler function call? Message-ID: <87E369A7FEF45C4D9980D1E99A74C8BD15C72C@BCMSG110.corp.ads> Without seeing your code I'd suggest you have a wild pointer somewhere in your program - you are writing to memory you don't own and causing undefined behaviour. > -----Original Message----- > From: expat-discuss-bounces at libexpat.org > [mailto:expat-discuss-bounces at libexpat.org] On Behalf Of > rodrigo_mora at sympatico.ca > Sent: Wednesday, July 06, 2005 2:32 PM > To: expat-discuss at libexpat.org > Subject: [Expat-discuss] How the attributes of "userdata" are > altered withevery handler function call? > > Hello, > > I have built a C Struc to keep track of the elements and > attributes that the handler functions read. I make the > explicit cast from "void* data* to my C Struc. In the first > pass, the attributes are stored correctly in the C Struct. > However, every time the handlers are called, the C Struct > attributes (that were initially stored correctly) change. > > In other words, every time the handlers are called they > override part of the information that has been stored (but > not through the program logic). Is like the "void* user data" > argument is corrupted with each handler function call. > > I have been trapped with this problem for a week. Does > anybody have an idea of why this is happening? > > Thank you in advance for your help! > -Rodrigo > > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss at libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss > From reid at x10sys.com Thu Jul 7 19:16:23 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 07 Jul 2005 10:16:23 -0700 Subject: [Expat-discuss] How the attributes of "userdata" are altered withevery handler function call? In-Reply-To: <87E369A7FEF45C4D9980D1E99A74C8BD15C72C@BCMSG110.corp.ads> References: <87E369A7FEF45C4D9980D1E99A74C8BD15C72C@BCMSG110.corp.ads> Message-ID: <1120756583.725.67.camel@bashful.x10sys.com> I've been helping Rodrigo with this off-list. He shared some code with me and it looks like he was holding on to some pointers provided to the callback functions rather than copying the strings they pointed to. I made some suggestions on how he could improve his code. Hopefully that will solve his issue. I don't think his situation has any pertinence to expat itself; its mostly a usage issue. Reid. On Thu, 2005-07-07 at 08:31 -0700, Greg Martin wrote: > Without seeing your code I'd suggest you have a wild pointer somewhere in your program - you are writing to memory you don't own and causing undefined behaviour. > > > -----Original Message----- > > From: expat-discuss-bounces at libexpat.org > > [mailto:expat-discuss-bounces at libexpat.org] On Behalf Of > > rodrigo_mora at sympatico.ca > > Sent: Wednesday, July 06, 2005 2:32 PM > > To: expat-discuss at libexpat.org > > Subject: [Expat-discuss] How the attributes of "userdata" are > > altered withevery handler function call? > > > > Hello, > > > > I have built a C Struc to keep track of the elements and > > attributes that the handler functions read. I make the > > explicit cast from "void* data* to my C Struc. In the first > > pass, the attributes are stored correctly in the C Struct. > > However, every time the handlers are called, the C Struct > > attributes (that were initially stored correctly) change. > > > > In other words, every time the handlers are called they > > override part of the information that has been stored (but > > not through the program logic). Is like the "void* user data" > > argument is corrupted with each handler function call. > > > > I have been trapped with this problem for a week. Does > > anybody have an idea of why this is happening? > > > > Thank you in advance for your help! > > -Rodrigo > > > > > > _______________________________________________ > > Expat-discuss mailing list > > Expat-discuss at libexpat.org > > http://mail.libexpat.org/mailman/listinfo/expat-discuss > > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss at libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://mail.libexpat.org/pipermail/expat-discuss/attachments/20050707/87e0d196/attachment.pgp From kwaclaw at teksavvy.com Thu Jul 7 23:16:06 2005 From: kwaclaw at teksavvy.com (kwaclaw@teksavvy.com) Date: Thu, 07 Jul 2005 17:16:06 -0400 Subject: [Expat-discuss] how to use XML_StopParser from within a handler? Message-ID: <19c2333301947d44615f3d973746cf41@teksavvy.com> > Hi, > > I've looked in reference.html and the mailing list but can't find an > answer to this basic question. My application traverses an XML document > until it finds what it's looking for, at which point it's done. I.e. > there's no point continuing to parse once that's been found, and the > section it's looking for can occur anywhere in the document. I could > just set a flag and abandon parsing the next time XML_Parse() returns > but according to the API it seems like XML_StopParser (with resumable=0) > is the "right" thing to do, presumably followed by XML_ParserFree once > XML_Parse returns. > > The doc for XML_StopParser says it should be invoked from a callback > handler. But its signature indicates it takes a pointer to the parser > object and that object is not presented to the handler. So how am I to > use XML_StopParser from within a callback? Must I make the parser object > static? No, that is what the userData pointer is for. It points to memory managed by your app, where you can store the parser reference. Karl From akumar at kodiaknetworks.com Tue Jul 19 06:59:09 2005 From: akumar at kodiaknetworks.com (Ajit Kumar) Date: Tue, 19 Jul 2005 04:59:09 -0000 Subject: [Expat-discuss] XML document validation Message-ID: <01d101c59fc3$c8916ca0$b302a8c0@Ajit> Hi, Can the property of expat to parse the DTD can be helpful in validating a XML document? If yes, than how? Regards Ajit From rolf at pointsman.de Tue Jul 19 14:59:42 2005 From: rolf at pointsman.de (rolf@pointsman.de) Date: Tue, 19 Jul 2005 14:59:42 +0200 (CEST) Subject: [Expat-discuss] XML document validation In-Reply-To: <01d101c59fc3$c8916ca0$b302a8c0@Ajit> Message-ID: <20050719125945.4D715675B9@pointsman.pointsman.de> On 13 Aug, Ajit Kumar wrote: > Can the property of expat to parse the DTD can be helpful in validating > a XML document? If yes, than how? First question: Almost yes. There are only very few information bits missing to do a full check of all validity constraints of the XML rec. As far as I'm aware, the missing bits are all related to DTD syntax checking. If you want to validate XML documents against a DTD, which is known to be valid, the answer is: Yes. Second question: You've to write the validation layer. Use the callbacks, which provides the information out of the DTD, store that information and do the content model etc. checks while parsing within your handler functions. I've written such code. Although it's not exactly a trivial task it also isn't extraordinary difficult. rolf -- Im Urlaub / On vacation: 2005-07-28 - 2005-08-12. From Andrew.Hardy at marconi.com Tue Jul 19 17:48:13 2005 From: Andrew.Hardy at marconi.com (Andrew Hardy) Date: Tue, 19 Jul 2005 16:48:13 +0100 Subject: [Expat-discuss] generated Makefile has wrong value set for INSTALL Message-ID: I have incorporated the expat build process into our combined software builds and it has been working fine. However recently a user other than myself carried out the same process ( cd expat; configure --prefix=/workingdirectory/expat; PATH=/usr/ccs/bin:$(PATH); /usr/local/bin/make all; /usr/local/bin/make install; cd .. ) The symptoms I think I have traced to, following the configure, the wrong value set in the generated Makefile for INSTALL. When I build I get it set to 'conftools/install-sh -c', but he gets it set to something quite different that looks like some local feature. I have been looking at the configure script to try to see what is used in this aprt of the Makefile generatio / fillin the blanks bit, but so far I have not managed to figure it out. I would be very grateful if some-one could put me straight. Many thanks, Andrew Hardy. From Andrew.Hardy at marconi.com Tue Jul 19 18:31:59 2005 From: Andrew.Hardy at marconi.com (Andrew Hardy) Date: Tue, 19 Jul 2005 17:31:59 +0100 Subject: [Expat-discuss] generated Makefile has wrong value set for INSTALL - 2 Message-ID: Ok, I think I have part of the answer. If there is an install existing in a bin directory in the users path then that one will be used instead of 'conftools/install-sh'. This is the case for the user who tried to build since me. However we want the build to be fixed and always use 'conftools/install-sh'. I am guessing it is some kind of configure option, but I'm not sure which. We have the --prefix option set, but that just says where the libraries etc go, not which install utility to use. Any help would be gratefully appreciated. Andrew H. ----- Forwarded by Andrew Hardy/MAIN/MC1 on 19/07/2005 17:28 ----- |---------+----------------------------> | | Andrew Hardy | | | | | | 19/07/2005 16:48 | | | | |---------+----------------------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| | | | To: expat-discuss at libexpat.org | | cc: | | Subject: generated Makefile has wrong value set for INSTALL | >--------------------------------------------------------------------------------------------------------------------------------------------------| I have incorporated the expat build process into our combined software builds and it has been working fine. However recently a user other than myself carried out the same process ( cd expat; configure --prefix=/workingdirectory/expat; PATH=/usr/ccs/bin:$(PATH); /usr/local/bin/make all; /usr/local/bin/make install; cd .. ) The symptoms I think I have traced to, following the configure, the wrong value set in the generated Makefile for INSTALL. When I build I get it set to 'conftools/install-sh -c', but he gets it set to something quite different that looks like some local feature. I have been looking at the configure script to try to see what is used in this aprt of the Makefile generatio / fillin the blanks bit, but so far I have not managed to figure it out. I would be very grateful if some-one could put me straight. Many thanks, Andrew Hardy. From akumar at kodiaknetworks.com Wed Jul 13 14:28:12 2005 From: akumar at kodiaknetworks.com (Ajit Kumar) Date: Wed, 13 Jul 2005 17:58:12 +0530 Subject: [Expat-discuss] XML schema parsing Message-ID: <022201c587a6$56af7f30$b302a8c0@Ajit> I have following doubts-- 1. I am required to validate XML document against a XML schema. Expat supports DTD parsing but does that mean that XML schema can also be parsed the same way? Regards Ajit From Andrew.Hardy at marconi.com Wed Jul 20 14:46:50 2005 From: Andrew.Hardy at marconi.com (Andrew Hardy) Date: Wed, 20 Jul 2005 13:46:50 +0100 Subject: [Expat-discuss] generated Makefile has wrong value set for INSTALL - 2 Message-ID: ----- Forwarded by Andrew Hardy/MAIN/MC1 on 20/07/2005 13:47 ----- |---------+----------------------------> | | Andrew Hardy | | | | | | 19/07/2005 17:31 | | | | |---------+----------------------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| | | | To: expat-discuss at libexpat.org | | cc: | | Subject: generated Makefile has wrong value set for INSTALL - 2 | >--------------------------------------------------------------------------------------------------------------------------------------------------| Ok, I think I have part of the answer. If there is an install existing in a bin directory in the users path then that one will be used instead of 'conftools/install-sh'. This is the case for the user who tried to build since me. However we want the build to be fixed and always use 'conftools/install-sh'. I am guessing it is some kind of configure option, but I'm not sure which. We have the --prefix option set, but that just says where the libraries etc go, not which install utility to use. Any help would be gratefully appreciated. Andrew H. ----- Forwarded by Andrew Hardy/MAIN/MC1 on 19/07/2005 17:28 ----- |---------+----------------------------> | | Andrew Hardy | | | | | | 19/07/2005 16:48 | | | | |---------+----------------------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| | | | To: expat-discuss at libexpat.org | | cc: | | Subject: generated Makefile has wrong value set for INSTALL | >--------------------------------------------------------------------------------------------------------------------------------------------------| I have incorporated the expat build process into our combined software builds and it has been working fine. However recently a user other than myself carried out the same process ( cd expat; configure --prefix=/workingdirectory/expat; PATH=/usr/ccs/bin:$(PATH); /usr/local/bin/make all; /usr/local/bin/make install; cd .. ) The symptoms I think I have traced to, following the configure, the wrong value set in the generated Makefile for INSTALL. When I build I get it set to 'conftools/install-sh -c', but he gets it set to something quite different that looks like some local feature. I have been looking at the configure script to try to see what is used in this aprt of the Makefile generatio / fillin the blanks bit, but so far I have not managed to figure it out. I would be very grateful if some-one could put me straight. Many thanks, Andrew Hardy. From reid at x10sys.com Thu Jul 21 03:59:06 2005 From: reid at x10sys.com (Reid Spencer) Date: Wed, 20 Jul 2005 18:59:06 -0700 Subject: [Expat-discuss] XML schema parsing In-Reply-To: <022201c587a6$56af7f30$b302a8c0@Ajit> References: <022201c587a6$56af7f30$b302a8c0@Ajit> Message-ID: <1121911146.30526.74.camel@bashful.x10sys.com> XML Schema is simply XML so expat can undoubtedly parse it. However, it doesn't do anything with it (e.g. validation). To expat, XML Schema documents are just simply another kind of XML document. Reid. On Wed, 2005-07-13 at 17:58 +0530, Ajit Kumar wrote: > I have following doubts-- > 1. I am required to validate XML document against a XML schema. > Expat supports DTD parsing but does that mean that XML schema can also > be parsed the same way? > > Regards > Ajit > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss at libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://mail.libexpat.org/pipermail/expat-discuss/attachments/20050720/c33bfff4/attachment.pgp From fpesposito at earthlink.net Wed Jul 20 23:31:21 2005 From: fpesposito at earthlink.net (Frank P Esposito) Date: Wed, 20 Jul 2005 17:31:21 -0400 (GMT-04:00) Subject: [Expat-discuss] Visual Studio *.dsp files Message-ID: <23261810.1121895081434.JavaMail.root@wamui-darkeyed.atl.sa.earthlink.net> I can't seem to get the *.dsp files for 1.95.8 to work in visual 6 (win/2k) -- it telles me that the files are NOT dsp files -- has anyone else had this problem? Frank From retooling at gmail.com Thu Jul 21 20:23:45 2005 From: retooling at gmail.com (TooAntsy) Date: Thu, 21 Jul 2005 11:23:45 -0700 Subject: [Expat-discuss] can I join? Message-ID: <81a6fee805072111232398059c@mail.gmail.com> I would like to subscribe to EXPAT mailing list. Thanks. Sincerely, Portia Soderberg