From webmaster at besthotel.com Fri Oct 3 23:07:35 2003 From: webmaster at besthotel.com (Webmaster) Date: Fri Oct 3 23:10:56 2003 Subject: [Expat-discuss] Need Assistance Installing Expat Message-ID: <000001c38a24$a9155870$6401a8c0@home> Hello, I'm having a great deal of problems trying to install expat on a unix machine that also has FreeBSD/Apache. When I tried to install the package, a list of BareWord errors scrolled by. I believe I attempted to install expat 1.0 or was it 2 ? Could some please aid me in this installation. Thanks From regis.st-gelais at laubrass.com Mon Oct 6 14:52:55 2003 From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=) Date: Mon Oct 6 14:53:00 2003 Subject: [Expat-discuss] Using expat 1.95.6 with Borland C++ 5.02 Message-ID: <00f201c38c3b$0daf7eb0$647ba8c0@regis> I'm new to expat. I am trying to build the outline sample with Borland C++ 5.02 I've created a projet create a dos exe. I've also set the library to point to the lib forlder "d:\expat-1.95.6\staticlibs" It compile fine but does not link I get 6 error like this one: "Undefined symbol _XML_Parse in module outline.c" TIA -- Regis From karl at waclawek.net Mon Oct 6 15:19:47 2003 From: karl at waclawek.net (Karl Waclawek) Date: Mon Oct 6 15:19:55 2003 Subject: [Expat-discuss] Using expat 1.95.6 with Borland C++ 5.02 References: <00f201c38c3b$0daf7eb0$647ba8c0@regis> Message-ID: <003801c38c3e$ce89e370$9e539696@citkwaclaww2k> > I'm new to expat. > > I am trying to build the outline sample with Borland C++ 5.02 > > I've created a projet create a dos exe. > I've also set the library to point to the lib forlder "d:\expat-1.95.6\staticlibs" > > It compile fine but does not link > I get 6 error like this one: "Undefined symbol _XML_Parse in module outline.c" Did you define XML_STATIC? Look at the elements sample - it uses the static libs. Karl From Greg.Martin at TELUS.COM Mon Oct 6 15:35:42 2003 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Mon Oct 6 15:36:17 2003 Subject: [Expat-discuss] Using expat 1.95.6 with Borland C++ 5.02 Message-ID: Did you tell the linker which library to link to? e.g. add -lexpat to your compilers arguments (sorry I don't Borlands syntax) -----Original Message----- From: R?gis St-Gelais [mailto:regis.st-gelais@laubrass.com] Sent: Monday, October 06, 2003 12:53 PM To: expat-discuss@libexpat.org Subject: [Expat-discuss] Using expat 1.95.6 with Borland C++ 5.02 I'm new to expat. I am trying to build the outline sample with Borland C++ 5.02 I've created a projet create a dos exe. I've also set the library to point to the lib forlder "d:\expat-1.95.6\staticlibs" It compile fine but does not link I get 6 error like this one: "Undefined symbol _XML_Parse in module outline.c" TIA -- Regis _______________________________________________ Expat-discuss mailing list Expat-discuss@libexpat.org http://mail.libexpat.org/mailman/listinfo/expat-discuss From toni.uusitalo at luukku.com Mon Oct 6 17:55:30 2003 From: toni.uusitalo at luukku.com (Toni Uusitalo) Date: Mon Oct 6 16:57:20 2003 Subject: [Expat-discuss] Using expat 1.95.6 with Borland C++ 5.02 Message-ID: <5.2.0.9.0.20031006233942.020fdea8@pop-112.luukku.com> this might help: http://mail.python.org/pipermail/expat-discuss/2001-April/000085.html Also google for words: expat borland 5 static etc. I believe borland lib format is different from ms lib? There's borland tool called COFF2OMF.EXE that converts MS lib to Borland lib, haven't used it, only read about it. There's folder for Borland C Builder (called BCB5) in the expat windows distribution, I don't know if makefiles can be used with your compiler... good luck Toni Uusitalo From regis.st-gelais at laubrass.com Tue Oct 7 16:22:39 2003 From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=) Date: Tue Oct 7 16:22:54 2003 Subject: Fw: [Expat-discuss] Using expat 1.95.6 with Borland C++ 5.02 Message-ID: <021501c38d10$c60a9000$647ba8c0@regis> ----- Original Message ----- From: Toni Uusitalo To: expat-discuss@libexpat.org Sent: Monday, October 06, 2003 5:55 PM Subject: [Expat-discuss] Using expat 1.95.6 with Borland C++ 5.02 this might help: http://mail.python.org/pipermail/expat-discuss/2001-April/000085.html Also google for words: expat borland 5 static etc. I believe borland lib format is different from ms lib? There's borland tool called COFF2OMF.EXE that converts MS lib to Borland lib, haven't used it, only read about it. There's folder for Borland C Builder (called BCB5) in the expat windows distribution, I don't know if makefiles can be used with your compiler... good luck Toni Uusitalo A already have BCC5.5 (the free command line compiler) and I've rebuild expat using the bcb5 folder. Using this I was able to rebuild the static libraries. It is working fine now, Thanks Regis St-Gelais From fdrake at acm.org Wed Oct 8 00:04:10 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Wed Oct 8 00:04:20 2003 Subject: [Expat-discuss] Expat 1.95.7 pending... Message-ID: <16259.36026.513178.658160@grendel.zope.com> I think we're about ready to release Expat 1.95.7. Does anyone have any remaining issues that need to be handled before this release? I'm hoping all that remains is to update the news and package the release. ;-) If that's not it, I'd really like to know in the next two days. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From uriel at estructures.com Fri Oct 10 19:52:19 2003 From: uriel at estructures.com (Uriel Kluk) Date: Fri Oct 10 19:52:24 2003 Subject: [Expat-discuss] Expat Embedded Message-ID: <005401c38f89$8aea7aa0$6501a8c0@eStructures.Van> Design question, I am looking for an XML parser for an embedded device and as occurs with every embedded system, I have resource limitations. The device consumes multiple applications (unique process space) and each requires XML parsing. Any advice on how to instantiate the library in multiple applications, but load it just once? Is the code re-entrant? Can I wrap it as a Singleton class? Thx, UK From karl at waclawek.net Fri Oct 10 20:38:40 2003 From: karl at waclawek.net (Karl Waclawek) Date: Fri Oct 10 20:38:04 2003 Subject: [Expat-discuss] Expat Embedded References: <005401c38f89$8aea7aa0$6501a8c0@eStructures.Van> Message-ID: <000f01c38f90$047eb060$1f12fea9@karl> > I am looking for an XML parser for an embedded device and as occurs with > every embedded system, I have resource limitations. > > The device consumes multiple applications (unique process space) and each > requires XML parsing. > > > > Any advice on how to instantiate the library in multiple applications, but > load it just once? > > Is the code re-entrant? No, it was not a design consideration, as far as I can tell. However, loading the library only once - that is, the Dll or .so file - should be OK, as the work is all done through parser instances. You will need one instance per thread/process. I have never done this, but I would think that the calls to XML_ParserCreate/Free are re-entrant. Also, if you can serialize complete parsing operations, then you can use the same parser instance multiple times. All you need to do is re-initialize it with XML_ParserReset for each parse. > > Can I wrap it as a Singleton class? You could wrap the library in one Singleton class, to manage loading and unloading the library. But it is important to keep the parser instances (created by calls to this class) separate for each thread. In a way this Singleton class is really a factory class. You could also use this class to serialize access to a single parser instance, for shared use as described above. Karl From fdrake at acm.org Sat Oct 11 15:29:21 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Sat Oct 11 15:29:43 2003 Subject: [Expat-discuss] Snapshot of current code Message-ID: <16264.23057.705221.39972@grendel.zope.com> I've placed a snapshot of the current code from CVS on the Expat website as: http://www.libexpat.org/expat-2003-10-11.tar.gz I've tested this on RedHat Linux 7.3 and 9.0, and built it on Intimate/Debian on an iPAQ (StrongARM processor) and run the "xmlwf" utility successfully. I'd like people with other platforms to try the source package and report any problems encountered; this is very close to what 1.95.7 will look like, and I'd like to discover any problems before release. Thanks! -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From mirod at xmltwig.com Mon Oct 13 13:04:30 2003 From: mirod at xmltwig.com (Michel Rodriguez) Date: Mon Oct 13 13:04:41 2003 Subject: [Expat-discuss] Snapshot of current code In-Reply-To: <16264.23057.705221.39972@grendel.zope.com> Message-ID: On Sat, 11 Oct 2003, Fred L. Drake, Jr. wrote: > I've placed a snapshot of the current code from CVS on the Expat > website as: > > http://www.libexpat.org/expat-2003-10-11.tar.gz > > I've tested this on RedHat Linux 7.3 and 9.0, and built it on > Intimate/Debian on an iPAQ (StrongARM processor) and run the "xmlwf" > utility successfully. > > I'd like people with other platforms to try the source package and > report any problems encountered; this is very close to what 1.95.7 > will look like, and I'd like to discover any problems before release. For Perl XML::Parser (and XML::Twig) both pass the tests OK with the snapshot. Thanks -- Michel Rodriguez Perl & XML http://www.xmltwig.com From Greg.Martin at TELUS.COM Tue Oct 14 12:33:52 2003 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Tue Oct 14 12:37:26 2003 Subject: [Expat-discuss] Small problem using 1.95.6 on Solaris 8 Message-ID: Using gcc 2.95.3 for Solaris SPARC 8 and C++ I had to move the definition for enum XML_Status up in expat.h to successfully build an application with expat-1.95.6. There was a warning when making the libraries about a compiler option being ignored (regparm I think - sorry I didn't capture the warning) but otherwise no problem. Greg Martin 780-493-2786 Service Solutions Chief Technology Office Technology & Operations TELUS Communication Inc. From fdrake at acm.org Tue Oct 14 13:27:22 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue Oct 14 13:27:54 2003 Subject: [Expat-discuss] Small problem using 1.95.6 on Solaris 8 In-Reply-To: References: Message-ID: <16268.12794.961164.15757@grendel.zope.com> Greg Martin writes: > Using gcc 2.95.3 for Solaris SPARC 8 and C++ I had to move the > definition for enum XML_Status up in expat.h to successfully build > an application with expat-1.95.6. There was a warning when making > the libraries about a compiler option being ignored (regparm I > think - sorry I didn't capture the warning) but otherwise no > problem. Greg, The first problem is fixed in CVS; we expect Expat 1.95.7 to be released shortly. I *think* the second problem has been fixed (it has been for some platforms at least); if you have time to test on your platform, there is a snapshot of the current code from CVS at: http://www.libexpat.org/expat-2003-10-11.tar.gz I'd be glad to hear about how that works for you. Thanks! -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From Greg.Martin at TELUS.COM Tue Oct 14 15:11:06 2003 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Tue Oct 14 15:15:25 2003 Subject: [Expat-discuss] Small problem using 1.95.6 on Solaris 8 Message-ID: Thanks Fred. expat-2003-10-11 has fixed the problems. -----Original Message----- From: Fred L. Drake, Jr. [mailto:fdrake@acm.org] Sent: Tuesday, October 14, 2003 11:27 AM To: Greg Martin Cc: Expat-discuss@libexpat.org Subject: Re: [Expat-discuss] Small problem using 1.95.6 on Solaris 8 Greg Martin writes: > Using gcc 2.95.3 for Solaris SPARC 8 and C++ I had to move the > definition for enum XML_Status up in expat.h to successfully build > an application with expat-1.95.6. There was a warning when making > the libraries about a compiler option being ignored (regparm I > think - sorry I didn't capture the warning) but otherwise no > problem. Greg, The first problem is fixed in CVS; we expect Expat 1.95.7 to be released shortly. I *think* the second problem has been fixed (it has been for some platforms at least); if you have time to test on your platform, there is a snapshot of the current code from CVS at: http://www.libexpat.org/expat-2003-10-11.tar.gz I'd be glad to hear about how that works for you. Thanks! -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From junk at solution.org.uk Wed Oct 15 11:19:09 2003 From: junk at solution.org.uk (Richard Barber) Date: Wed Oct 15 11:19:12 2003 Subject: [Expat-discuss] Entity References when there's no DTD Message-ID: Hi, Many apologies for just signing up to get a question answered ;-) I'm currently trying to produce an XML parser that is able to deal with documents which do generally not contain any specific DTD sections or references. However I'm having a few problems with expat returning XML_ERROR_UNDEFINED_ENTITY instead of calling my 'skippedEntityHandler' when it encounters entities such as: san & josé & (I want this come out the far end as san & josé &) But instead it errors - as the DTD has not defined any other Entity References (see xmlparse.c:1988) and 'eacute' is not a recognised built in entity value. (it parses the & and & inside XmlTok() as i'd expected) However, what I can't work out is whether this 'error' behaviour is correct as to the XML spec or whether expat is doing 'the wrong thing'(tm) in this case? There are few lines from about xmlparse.c:1986 which seem to require some kind of DTD to have been defined before the 'skippedEntityHandler' will be called... anyone have any ideas?! Many thanks, Richard From karl at waclawek.net Wed Oct 15 11:25:47 2003 From: karl at waclawek.net (Karl Waclawek) Date: Wed Oct 15 11:27:15 2003 Subject: [Expat-discuss] Entity References when there's no DTD References: Message-ID: <005b01c39330$9bb50170$9e539696@citkwaclaww2k> > Hi, > > Many apologies for just signing up to get a question answered ;-) > > I'm currently trying to produce an XML parser that is able > to deal with documents which do generally not contain any > specific DTD sections or references. > > However I'm having a few problems with expat returning > XML_ERROR_UNDEFINED_ENTITY instead of calling my > 'skippedEntityHandler' when it encounters entities such as: > > san & josé & > (I want this come out the far end as san & josé &) > > But instead it errors - as the DTD has not defined any > other Entity References (see xmlparse.c:1988) and 'eacute' is > not a recognised built in entity value. > (it parses the & and & inside XmlTok() as i'd expected) > > However, what I can't work out is whether this 'error' behaviour is > correct as to the XML spec or whether expat is doing 'the wrong thing'(tm) > in this case? > > There are few lines from about xmlparse.c:1986 which seem to > require some kind of DTD to have been defined before the > 'skippedEntityHandler' will be called... anyone have any ideas?! If I remember correctly, the skippedEntityHandler will only be called if it is not an error when an entity reference is encountered for which no entity has been declared. This can happen for a non-validating parser like Expat, but not for a validating one. If it is an error, then an error will be returned. This is the comment in expat.h: /* This is called in two situations: 1) An entity reference is encountered for which no declaration has been read *and* this is not an error. 2) An internal entity reference is read, but not expanded, because XML_SetDefaultHandler has been called. Note: skipped parameter entities in declarations and skipped general entities in attribute values cannot be reported, because the event would be out of sync with the reporting of the declarations or attribute values */ Karl From junk at solution.org.uk Wed Oct 15 11:52:38 2003 From: junk at solution.org.uk (Richard Barber) Date: Wed Oct 15 11:52:40 2003 Subject: [Expat-discuss] Re: Entity References when there's no DTD Message-ID: On Wed, 15 Oct 2003, Karl Waclawek wrote: > 1) An entity reference is encountered for which no declaration > has been read *and* this is not an error. OK, my real question was 'what constitutes an error?' - but I just found http://www.w3.org/TR/REC-xml#wf-entdeclared which defines the very problem as a 'Well-formedness constraint': "In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", for an entity reference that does not occur within the external subset or a parameter entity, the Name given in the entity reference must match that in an entity declaration that does not occur within the external subset or a parameter entity, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot." Thanks for the help anyway ;-) Richard From karl at waclawek.net Wed Oct 15 12:25:14 2003 From: karl at waclawek.net (Karl Waclawek) Date: Wed Oct 15 12:25:51 2003 Subject: [Expat-discuss] Re: Entity References when there's no DTD References: Message-ID: <008701c39338$e9b23d90$9e539696@citkwaclaww2k> > On Wed, 15 Oct 2003, Karl Waclawek wrote: > > > 1) An entity reference is encountered for which no declaration > > has been read *and* this is not an error. > > OK, my real question was 'what constitutes an error?' Yes, but that's not an Expat question.;-) > - but I > just found http://www.w3.org/TR/REC-xml#wf-entdeclared > which defines the very problem as a 'Well-formedness constraint': > > "In a document without any DTD, a document with only an internal DTD > subset which contains no parameter entity references, or a document with > "standalone='yes'", for an entity reference that does not occur within > the external subset or a parameter entity, the Name given in the entity > reference must match that in an entity declaration that does not occur > within the external subset or a parameter entity, except that well-formed > documents need not declare any of the following entities: amp, lt, gt, > apos, quot." Not easy to read ... Karl From fdrake at acm.org Wed Oct 15 14:15:05 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Wed Oct 15 14:30:06 2003 Subject: [Expat-discuss] Second pre-1.95.7 snapshot Message-ID: <16269.36521.570960.932803@grendel.zope.com> I've made a second snapshot of the current state of Expat in CVS; it's available as http://www.libexpat.org/expat-2003-10-15.tar.gz The implementation hasn't really changed... but the declarations of every entry point have been re-written. The purpose of making a second snapshot available is to catch any unintentional changes to the API by the restructuring of the macros in the source. The changes don't really affect the internals of Expat, and should not affect the API used by any working application, but are pervasive. The changes were needed to address the concerns described in this patch report: http://sourceforge.net/tracker/index.php?func=detail&aid=820946&group_id=10127&atid=310127 If you have time to test this snapshot, please report your results to the list. If all goes well, I'll release Expat 1.95.7 this weekend. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake at acm.org Wed Oct 15 17:08:26 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Wed Oct 15 17:23:19 2003 Subject: [Expat-discuss] 3rd pre-1.95.7 snapshot Message-ID: <16269.46922.506537.731155@grendel.zope.com> I've just posted an update snapshot of the CVS version of Expat: http://www.libexpat.org/expat-2003-10-15.tar.gz This corrects deficiencies in the last round of changes for some platforms, including the ever-popular Windows platform. I still plan on releasing Expat 1.95.7 this weekend. Our current expectation is that the 1.95.x line will end this year, with a re-christening of the code base as Expat 2.0. The code will be maintained for portability and stability from that point on. Further development will take place for Expat 3.0; see the Expat Development Roadmap for more information on this: http://www.libexpat.org/dev/roadmap.html -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From Greg.Martin at TELUS.COM Wed Oct 15 17:54:23 2003 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Wed Oct 15 17:54:38 2003 Subject: [Expat-discuss] 3rd pre-1.95.7 snapshot Message-ID: Solaris SPARC 8 produced warnings during the make stage about cdecl and dllimport attribute directives being ignored. Greg Martin 780-493-2786 Service Solutions Chief Technology Office Technology & Operations TELUS Communication Inc. -----Original Message----- From: Fred L. Drake, Jr. [mailto:fdrake@acm.org] Sent: Wednesday, October 15, 2003 3:08 PM To: expat-discuss@mail.libexpat.org Subject: [Expat-discuss] 3rd pre-1.95.7 snapshot I've just posted an update snapshot of the CVS version of Expat: http://www.libexpat.org/expat-2003-10-15.tar.gz This corrects deficiencies in the last round of changes for some platforms, including the ever-popular Windows platform. I still plan on releasing Expat 1.95.7 this weekend. Our current expectation is that the 1.95.x line will end this year, with a re-christening of the code base as Expat 2.0. The code will be maintained for portability and stability from that point on. Further development will take place for Expat 3.0; see the Expat Development Roadmap for more information on this: http://www.libexpat.org/dev/roadmap.html -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation _______________________________________________ Expat-discuss mailing list Expat-discuss@libexpat.org http://mail.libexpat.org/mailman/listinfo/expat-discuss From gnand001 at odu.edu Sun Oct 19 01:35:25 2003 From: gnand001 at odu.edu (GIRIDHAR NANDIGAM) Date: Sun Oct 19 01:39:47 2003 Subject: [Expat-discuss] Glade expat help Required. Message-ID: Hello, I am trying to compile my Glade programme with expat . But i have no idea where to specify the library file libexpat.a . I am using the gcc compiler. Help is needed urgently. Thanks in Advance. Giridhar Nandigam From Greg.Martin at TELUS.COM Mon Oct 20 11:40:39 2003 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Mon Oct 20 11:42:33 2003 Subject: [Expat-discuss] Glade expat help Required. Message-ID: I don't use Glade, Gnome or very often use automake but seeing as you wrote that help is needed urgently ... try adding the lines LIBS="$LIBS -lexpat" AC_SUBST(LIBS) somewhere before AC_OUTPUT in configure.in. Failing that read up on automake/autoconf and the Gnome documentation. -----Original Message----- From: GIRIDHAR NANDIGAM [mailto:gnand001@odu.edu] Sent: Saturday, October 18, 2003 11:35 PM To: expat-discuss@libexpat.org Subject: [Expat-discuss] Glade expat help Required. Hello, I am trying to compile my Glade programme with expat . But i have no idea where to specify the library file libexpat.a . I am using the gcc compiler. Help is needed urgently. Thanks in Advance. Giridhar Nandigam _______________________________________________ Expat-discuss mailing list Expat-discuss@libexpat.org http://mail.libexpat.org/mailman/listinfo/expat-discuss From fdrake at acm.org Mon Oct 20 11:56:13 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon Oct 20 11:56:25 2003 Subject: [Expat-discuss] 3rd pre-1.95.7 snapshot In-Reply-To: References: Message-ID: <16276.1437.652424.252092@grendel.zope.com> Greg Martin writes: > Solaris SPARC 8 produced warnings during the make stage about cdecl > and dllimport attribute directives being ignored. I think this is now fixed in CVS. There wasn't time to make the release over the weekend; I'll try again tonight. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake at acm.org Tue Oct 21 00:25:48 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue Oct 21 00:26:15 2003 Subject: [Expat-discuss] Expat 1.95.7 released Message-ID: <16276.46412.673180.654418@grendel.zope.com> Expat 1.95.7 is now available for download. This release fixes a variety of problems, including the truly nasty "enum XML_Status" problem, which affected many compilers (just not those used by the maintainers at the time, unfortunately), and many build issues that affect one platform or another. Existing working applications which use Expat should not need any changes to work with the new version, though application maintainers should review the changes carefully to determine the potential impact of the specific changes that have been made. The following changes have been made since the previous release: - Fixed enum XML_Status issue (reported on SourceForge many times), so compilers that are properly picky will be happy. - Introduced an XMLCALL macro to control the calling convention used by the Expat API; this macro should be used to annotate prototypes and definitions of callback implementations in code compiled with a calling convention other than the default convention for the host platform. - Improved ability to build without the configure-generated expat_config.h header. This is useful for applications which embed Expat rather than linking in the library. - Fixed a variety of bugs: see SF issues 458907, 609603, 676844, 679754, 692878, 692964, 695401, 699323, 699487, 820946. - Improved hash table lookups. - Added more regression tests and improved documentation. Additional information about Expat can be found at the Expat website: http://www.libexpat.org/ This release can be downloaded from SourceForge: http://sourceforge.net/project/showfiles.php?group_id=10127 -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From aleigh at potassium.ssi.swin.edu.au Tue Oct 21 03:02:36 2003 From: aleigh at potassium.ssi.swin.edu.au (Alan Leigh) Date: Tue Oct 21 03:19:45 2003 Subject: [Expat-discuss] static libexpat library Message-ID: Hi all, My program uses expat, which works well. The problem is I am now trying to build my project linking expat staticly. If I build with the correct paths (-L and -I) and use -lexpat everything builds and links ok. If I do this instead -l/usr/lib/libexpat.a , I get a whole heap of undefined reference errors (XML_ParserCreate... XML_SetElementHandler etc etc). Any ideas? Or is what I am doing wrong? Cheers, Alan From fdrake at acm.org Tue Oct 21 03:22:45 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue Oct 21 03:22:49 2003 Subject: [Expat-discuss] static libexpat library In-Reply-To: References: Message-ID: <16276.57029.288653.289199@grendel.zope.com> Alan Leigh writes: > My program uses expat, which works well. The problem is I am now trying to > build my project linking expat staticly. If I build with the correct > paths (-L and -I) and use -lexpat everything builds and links ok. If I do > this instead -l/usr/lib/libexpat.a , I get a whole heap of undefined > reference errors (XML_ParserCreate... XML_SetElementHandler etc etc). Any > ideas? Or is what I am doing wrong? To specify a static library using a complete pathname, don't use the -l option, just name the library. "-l" should only be used with the "short" name of the library ("expat" in this case). What's happening in your example is that the library lib/usr/lib/libexpat.a.a isn't being found. The error message certainly isn't very helpful, but matches my experience. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From Greg.Martin at TELUS.COM Tue Oct 21 14:07:43 2003 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Tue Oct 21 14:10:15 2003 Subject: [Expat-discuss] Expat 1.95.7 released Message-ID: Thanks Fred. I still have the cdecl problem on sparc so I added #ifdef sparc #define XMLCALL #endif to lib/expat.h before the macro is set. I'm don't imagine this is the "right" way to deal with the problem and it may occur on other non-x86 platforms as well. I'm unable to get to the CVS repository from work (firewall) so was unable to test before the release. I have some other platforms here (tru64 and RS6000). I'll try to get to building on them this week if it helps. Greg Martin 780-493-2786 Service Solutions Chief Technology Office Technology & Operations TELUS Communication Inc. -----Original Message----- From: Fred L. Drake, Jr. [mailto:fdrake@acm.org] Sent: Monday, October 20, 2003 10:26 PM To: expat-discuss@mail.libexpat.org Subject: [Expat-discuss] Expat 1.95.7 released Expat 1.95.7 is now available for download. This release fixes a variety of problems, including the truly nasty "enum XML_Status" problem, which affected many compilers (just not those used by the maintainers at the time, unfortunately), and many build issues that affect one platform or another. Existing working applications which use Expat should not need any changes to work with the new version, though application maintainers should review the changes carefully to determine the potential impact of the specific changes that have been made. The following changes have been made since the previous release: - Fixed enum XML_Status issue (reported on SourceForge many times), so compilers that are properly picky will be happy. - Introduced an XMLCALL macro to control the calling convention used by the Expat API; this macro should be used to annotate prototypes and definitions of callback implementations in code compiled with a calling convention other than the default convention for the host platform. - Improved ability to build without the configure-generated expat_config.h header. This is useful for applications which embed Expat rather than linking in the library. - Fixed a variety of bugs: see SF issues 458907, 609603, 676844, 679754, 692878, 692964, 695401, 699323, 699487, 820946. - Improved hash table lookups. - Added more regression tests and improved documentation. Additional information about Expat can be found at the Expat website: http://www.libexpat.org/ This release can be downloaded from SourceForge: http://sourceforge.net/project/showfiles.php?group_id=10127 -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation _______________________________________________ Expat-discuss mailing list Expat-discuss@libexpat.org http://mail.libexpat.org/mailman/listinfo/expat-discuss From fdrake at acm.org Tue Oct 21 14:45:53 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue Oct 21 14:46:33 2003 Subject: [Expat-discuss] Obnoxious warnings from GCC In-Reply-To: References: Message-ID: <16277.32481.499083.12277@grendel.zope.com> Greg Martin writes: > Thanks Fred. I still have the cdecl problem on sparc so I added Ouch! I think this is GCC being really annoying; they seem to generate warnings when attributes have no effect because they match the default. I think that's wrong, but... I'm not on the GCC crew. > #ifdef sparc > #define XMLCALL > #endif > to lib/expat.h before the macro is set. I'm don't imagine this is > the "right" way to deal with the problem and it may occur on other > non-x86 platforms as well. I'm unable to get to the CVS repository > from work (firewall) so was unable to test before the release. I > have some other platforms here (tru64 and RS6000). I'll try to get > to building on them this week if it helps. That would be wonderful! -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From Greg.Martin at TELUS.COM Tue Oct 21 15:58:49 2003 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Tue Oct 21 18:09:27 2003 Subject: [Expat-discuss] RE: Obnoxious warnings from GCC Message-ID: No problem on tru64 on DEC Alpha but I was using Digital's C compiler so it probably didn't define the macro as anything. AIX 5L on PowerPC using gcc version 2.9-aix43-010414 produced the warnings as well. Greg. -----Original Message----- From: Fred L. Drake, Jr. [mailto:fdrake@acm.org] Sent: Tuesday, October 21, 2003 12:46 PM To: Greg Martin Cc: expat-discuss@mail.libexpat.org Subject: Obnoxious warnings from GCC Greg Martin writes: > Thanks Fred. I still have the cdecl problem on sparc so I added Ouch! I think this is GCC being really annoying; they seem to generate warnings when attributes have no effect because they match the default. I think that's wrong, but... I'm not on the GCC crew. > #ifdef sparc > #define XMLCALL > #endif > to lib/expat.h before the macro is set. I'm don't imagine this is > the "right" way to deal with the problem and it may occur on other > non-x86 platforms as well. I'm unable to get to the CVS repository > from work (firewall) so was unable to test before the release. I > have some other platforms here (tru64 and RS6000). I'll try to get > to building on them this week if it helps. That would be wonderful! -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From wendell at adsi-m4.com Mon Oct 27 12:56:57 2003 From: wendell at adsi-m4.com (Wendell Turner) Date: Mon Oct 27 13:15:03 2003 Subject: [Expat-discuss] how to encode xml document? Message-ID: <20031027125657.A31082@adsi-m4.com> How can I generate an XML document? That is, given that the (first) XML document has been input and decoded by XML_Parse, I want to change some of the data fields, and output a (second) valid XML document. Are there routines in expat that do this, or does each element handler need to know how to do a 'printf' of its data, surrounded by the appropriate tags and attributes? (I didn't see anything in the examples directory that suggested how to do that, nor in the mail archives.) Wendell From fdrake at acm.org Mon Oct 27 13:43:17 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon Oct 27 13:43:27 2003 Subject: [Expat-discuss] how to encode xml document? In-Reply-To: <20031027125657.A31082@adsi-m4.com> References: <20031027125657.A31082@adsi-m4.com> Message-ID: <16285.26437.336780.929487@grendel.zope.com> Wendell Turner writes: > How can I generate an XML document? That is, given that the > (first) XML document has been input and decoded by XML_Parse, I > want to change some of the data fields, and output a (second) > valid XML document. Are there routines in expat that do this, > or does each element handler need to know how to do a 'printf' > of its data, surrounded by the appropriate tags and attributes? Expat does not include any facilities for representing an XML document in memory or for serializing such a document. There are a variety of libraries built on top of Expat; some of these are likely to provide this facility. More information on 3rd-party libraries built on top of Expat can be found at: http://www.libexpat.org/#wrappers -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From steven_nikkel at ertyu.org Mon Oct 27 15:52:39 2003 From: steven_nikkel at ertyu.org (Steven Nikkel) Date: Mon Oct 27 15:52:44 2003 Subject: [Expat-discuss] Expat 1.95.7 released Message-ID: > Expat 1.95.7 is now available for download. This release fixes a > variety of problems, including the truly nasty "enum XML_Status" > problem, which affected many compilers (just not those used by the > maintainers at the time, unfortunately), and many build issues that > affect one platform or another. SNIP > - Improved ability to build without the configure-generated > expat_config.h header. This is useful for applications > which embed Expat rather than linking in the library. I'm particularly interested in this update. What has changed? I still see xmlparse.c, xmlrole.c, xmltok.c include expat_config.h. What is the best way to embed Expat? From fdrake at acm.org Mon Oct 27 16:02:13 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon Oct 27 16:02:22 2003 Subject: [Expat-discuss] Expat 1.95.7 released In-Reply-To: References: Message-ID: <16285.34773.384145.273648@grendel.zope.com> Steven Nikkel writes: > I'm particularly interested in this update. What has changed? I still see > xmlparse.c, xmlrole.c, xmltok.c include expat_config.h. What has changed is that they only include expat_config.h if HAVE_EXPAT_CONFIG_H is defined, which is only done from the Makefile. If you use a Makefile that doesn't define that, you can defined HAVE_MEMCOPY and/or HAVE_BCOPY (as appropriate for your platform), and not need to generate an expat_config.h. You can now copy *.[ch] from the lib/ directory and use them as-is. We're using this for the Python bindings for Expat, for which we don't want to use a separate library (especially since that module is normally built as a separate dynamically-loaded module anyway). -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From steven_nikkel at ertyu.org Mon Oct 27 16:49:10 2003 From: steven_nikkel at ertyu.org (Steven Nikkel) Date: Mon Oct 27 16:49:19 2003 Subject: [Expat-discuss] Expat 1.95.7 released In-Reply-To: <16285.34773.384145.273648@grendel.zope.com> References: <16285.34773.384145.273648@grendel.zope.com> Message-ID: > What has changed is that they only include expat_config.h if > HAVE_EXPAT_CONFIG_H is defined, which is only done from the Makefile. > If you use a Makefile that doesn't define that, you can defined > HAVE_MEMCOPY and/or HAVE_BCOPY (as appropriate for your platform), and > not need to generate an expat_config.h. > Thanks. Just for future reference to whoever might read this, the two defines are HAVE_BCOPY and HAVE_MEMMOVE. From fdrake at acm.org Mon Oct 27 16:51:34 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Mon Oct 27 16:51:42 2003 Subject: [Expat-discuss] Expat 1.95.7 released In-Reply-To: References: <16285.34773.384145.273648@grendel.zope.com> Message-ID: <16285.37734.797824.910742@grendel.zope.com> Steven Nikkel writes: > Just for future reference to whoever might read this, the two defines are > HAVE_BCOPY and HAVE_MEMMOVE. Argh! I should know not to rely on my memory! -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From Ponnusamy.Anand at choicepoint.com Tue Oct 28 15:22:48 2003 From: Ponnusamy.Anand at choicepoint.com (Ponnusamy.Anand@choicepoint.com) Date: Tue Oct 28 15:25:50 2003 Subject: [Expat-discuss] (no subject) Message-ID: Hello everbody, I'm using Expat 1.95.6 on Solaris 2.8. I'm making a stored procedure call to the database and retrieving data through cursors. After that I add xml tags to the all the data values which replace those special characters ("&"; "<"; ">"; "\""; "'";) to ones understood in xml world like (&, <, >, ", &apos). Then I use Expat to parse the values. But unfortunately, Expat is truncating the value from Anand's Battery Service into 's Anand Service and BRAKE & OIL into OIL in the following sample Anand's Battery Service BRAKE & OIL Can someone please explain how I need to get around this special character problem? Thanks in advance, Regards, P. Anand From karl at waclawek.net Tue Oct 28 15:58:25 2003 From: karl at waclawek.net (Karl Waclawek) Date: Tue Oct 28 15:58:53 2003 Subject: [Expat-discuss] (no subject) References: Message-ID: <003f01c39d96$3af55e00$9e539696@citkwaclaww2k> > Hello everbody, > > I'm using Expat 1.95.6 on Solaris 2.8. I'm making a stored procedure call > to the database and retrieving data through cursors. After that I add xml > tags to the all the data values which replace those special characters > ("&"; "<"; ">"; "\""; "'";) to ones understood in xml world like (&, > <, >, ", &apos). Then I use Expat to parse the values. But > unfortunately, Expat is truncating the value from Anand's Battery > Service into 's Anand Service and BRAKE & OIL into OIL in the > following sample > > Anand's Battery Service > BRAKE & OIL > > Can someone please explain how I need to get around this special character > problem? Works fine on Windows. No truncated content. Are you saying it is truncating from the front? Karl From klj at donnell.com Tue Oct 28 16:17:55 2003 From: klj at donnell.com (Ken Johnston) Date: Tue Oct 28 16:17:24 2003 Subject: [Expat-discuss] (no subject) In-Reply-To: <003f01c39d96$3af55e00$9e539696@citkwaclaww2k> Message-ID: <000901c39d98$fa131410$1ec909c0@dev.donnell.com> I use Expat on Solaris and have no trouble with entity references. Expat just transparently handles them. I wonder if the text data call back function breaks the string into multiple calls when it sees one. It looks like chunks of text are swapping position from your example. Maybe your call back function isn't handling multiple calls for one element correctly. Ken > -----Original Message----- > From: expat-discuss-bounces@libexpat.org [mailto:expat-discuss- > bounces@libexpat.org] On Behalf Of Karl Waclawek > Sent: Tuesday, October 28, 2003 3:58 PM > To: expat-discuss@libexpat.org; Ponnusamy.Anand@choicepoint.com > Subject: Re: [Expat-discuss] (no subject) > > > > > Hello everbody, > > > > I'm using Expat 1.95.6 on Solaris 2.8. I'm making a stored procedure > call > > to the database and retrieving data through cursors. After that I add > xml > > tags to the all the data values which replace those special characters > > ("&"; "<"; ">"; "\""; "'";) to ones understood in xml world like (&, > > <, >, ", &apos). Then I use Expat to parse the values. But > > unfortunately, Expat is truncating the value from Anand's Battery > > Service into 's Anand Service and BRAKE & OIL into OIL in the > > following sample > > > > Anand's Battery Service > > BRAKE & OIL > > > > Can someone please explain how I need to get around this special > character > > problem? > > Works fine on Windows. No truncated content. > Are you saying it is truncating from the front? > > Karl > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss@libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss From fdrake at acm.org Tue Oct 28 16:17:04 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue Oct 28 16:17:30 2003 Subject: [Expat-discuss] (no subject) In-Reply-To: References: Message-ID: <16286.56528.711654.729041@grendel.zope.com> Ponnusamy.Anand@choicepoint.com writes: > Can someone please explain how I need to get around this special character > problem? I suspect you're only looking at the result of a single call to your character data handler, but can't be sure without seeing your code. The character data handler should accumulate data at each successive call; the data will be available when the end-element handler is called. I'll be expanding the documentation related to this, as this is a common stumbling block. For now, it is mentioned in the documentation for XML_SetCharacterDataHandler(). -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From Ponnusamy.Anand at choicepoint.com Tue Oct 28 16:34:07 2003 From: Ponnusamy.Anand at choicepoint.com (Ponnusamy.Anand@choicepoint.com) Date: Tue Oct 28 16:37:22 2003 Subject: [Expat-discuss] (no subject) Message-ID: This is the application code (API) we use to parse the XML document. #include #include #include "../xmlparse/xmlparse.h" #include "/export/home/expat/work/include/XMLParseAPI.h" /*----------------------------------------------------------------------------*/ #define SUCCESS 0 #define FAILURE -1 #define TRUE 1 #define FALSE 0 /*----------------------------------------------------------------------------*/ static char *elementname = ""; static int errorlinenumber = 0; static char errorlinetext[256] = ""; /*----------------------------------------------------------------------------*/ int (*elementvaluehandler)(char *elementname, char *s, int len) = NULL; /*----------------------------------------------------------------------------*/ char * XMLGetError(int *linenumber) { *linenumber = errorlinenumber; return errorlinetext; } /*----------------------------------------------------------------------------*/ void XMLSetElementValueHandler(int (*f)(char *, char *, int)) { elementvaluehandler = f; } /*----------------------------------------------------------------------------*/ static int trim_length_text(char *text, int *len) { register int ii; for (ii = 0; ii < *len; ii++) if (text[ii] != ' ' && text[ii] != '\t' && text[ii] != '\n') return *len; *len = 0; return *len; } /*----------------------------------------------------------------------------*/ void XMLStartElementHandler(void *data, const char *el, const char **attr) { if (* el) elementname = (char *) el; } /*----------------------------------------------------------------------------*/ void XMLEndElementHandler(void *data, const char *el) { /* leaving what ? */ printf("%s\n", el); } /*----------------------------------------------------------------------------*/ void XMLCharacterHandler(void *data, const char *s, int len) { trim_length_text((char *) s, &len); if (len) { elementvaluehandler(elementname, (char *) s, len); /*----------------------------------------------------------------------------*/ int XMLElementParse(char *xml, void (*xmlstartelementhandler)(void *, const char *, const char **), int (*xmlelementvaluehandler)(char *, char *, int), void (*xmlendelementhandler) (void *, const char *)) int rc = SUCCESS; const char *encoding = "ISO-8859-1"; XML_Parser p; errorlinenumber = 0; memset(errorlinetext, '\0', sizeof(errorlinetext)); p = XML_ParserCreate(encoding); if (!p) { return FAILURE; } XML_UseParserAsHandlerArg(p); XML_SetCharacterDataHandler(p, XMLCharacterHandler); XML_SetElementHandler(p, xmlstartelementhandler, xmlendelementhandler); XMLSetElementValueHandler(xmlelementvaluehandler); if (!XML_Parse(p, xml, strlen(xml), TRUE)) { errorlinenumber = XML_GetCurrentLineNumber(p); strncpy(errorlinetext, XML_ErrorString(XML_GetErrorCode(p)), 255); rc = FAILURE; } XML_ParserFree(p); return rc; } Regards, P. Anand (770)619-8319 (Office) (678)576-8604 (Mobile) "Fred L. Drake, Jr." To: Ponnusamy.Anand@choicepoint.com cc: expat-discuss@libexpat.org Subject: Re: [Expat-discuss] (no subject) 10/28/2003 04:17 PM Ponnusamy.Anand@choicepoint.com writes: > Can someone please explain how I need to get around this special character > problem? I suspect you're only looking at the result of a single call to your character data handler, but can't be sure without seeing your code. The character data handler should accumulate data at each successive call; the data will be available when the end-element handler is called. I'll be expanding the documentation related to this, as this is a common stumbling block. For now, it is mentioned in the documentation for XML_SetCharacterDataHandler(). -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From regis.st-gelais at laubrass.com Tue Oct 28 17:33:40 2003 From: regis.st-gelais at laubrass.com (=?Windows-1252?Q?R=E9gis_St-Gelais?=) Date: Tue Oct 28 17:34:27 2003 Subject: [Expat-discuss] Abort parsing from inside an handler? Message-ID: <019301c39da3$894e3560$647ba8c0@regis> Hi, Let say I'm inside the elementstart handler and I detect something wrong in the file format. I want to stop the parsing process. Right now I do the following: In my userdata structure I have: bool bolError In my elementstart handler, if I detect an error, I set bolError to true. In my main loop, after the XML_Parse call, I check the bolError flag and I stop the parsing if necessary. It work not so bad but the parsing does not stop immediately when I catch the error but when the current buffer sent to XML_Parse in completely parsed. So my question is: is there a way to abort the parsing from inside an handler? ( I use expat 1.95.7) Thanks Regis From fdrake at acm.org Tue Oct 28 17:41:17 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue Oct 28 17:41:31 2003 Subject: [Expat-discuss] Abort parsing from inside an handler? In-Reply-To: <019301c39da3$894e3560$647ba8c0@regis> References: <019301c39da3$894e3560$647ba8c0@regis> Message-ID: <16286.61581.295766.45826@grendel.zope.com> R?gis St-Gelais writes: > So my question is: is there a way to abort the parsing from inside an > handler? Unfortunately, no. This is a specific goal for Expat 3.0 however. What you can do in the current version, in addition to setting a flag, is to clear all the handlers *except* the external entity reference handler. This handler should be set to something that always indicates an error occurred, and XML_SetParamEntityParsing() should be called with XML_PARAM_ENTITY_PARSING_ALWAYS (unless you're already in the document body, since it makes no sense then), so that Expat will exit as quickly as possible. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From carlos at pehoe.civil.ist.utl.pt Tue Oct 28 18:58:18 2003 From: carlos at pehoe.civil.ist.utl.pt (Carlos Pereira) Date: Tue Oct 28 18:49:33 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? Message-ID: <20031028235818.E83FE89F@pehoe.civil.ist.utl.pt> >>So my question is: is there a way to abort the parsing from inside an >>handler? >Unfortunately, no. This is a specific goal for Expat 3.0 however. What? aborting the parsing from inside a handler is easy, you just have to do (for example, to disable ElementStart and ElementEnd callbacks at once, when an error is found): ------------------- /********************************** * disable Expat parser callbacks * **********************************/ if (ml->valid == FALSE) XML_SetElementHandler (ml->parser, NULL, NULL); -------------------------- Actually, I am disabling and enabling callbacks all the time when I parse my files, as a routine operation. For example in my case I have an app called gamgi, so I have files like this: an element outside a block is considered object data while an element inside a block is considered configuration data. The attributes in general are different and everything is different for the two elements above, so everytime a block appears in a file (and it can appear an unlimited number of times, in any sequence) I have to disable the object callbacks and enable the configuration callbacks. When the appears, I disable the configuration callbacks and enable again the object callbacks. All these is done when calling a normal XMLParse instruction, and of course the instructions to enable/disable callbacks must be in the handler... All of this works perfect even with unlimited external entities: files calling others recursively (with sucessively new parsers) without any limit on the number of nested levels... and disabling/enabling callbacks automatically all the time ;-)... it's fast and clean... This is in the manual, so I am fairly surprised... Am I missing something? are we talking of different things? I am sorry if that is the case... Carlos From karl at waclawek.net Tue Oct 28 19:16:21 2003 From: karl at waclawek.net (Karl Waclawek) Date: Tue Oct 28 19:14:47 2003 Subject: [Expat-discuss] Abort parsing from inside an handler? References: <019301c39da3$894e3560$647ba8c0@regis> Message-ID: <001601c39db1$e18e7dd0$1f12fea9@karl> > So my question is: is there a way to abort the parsing from inside an > handler? >From C: use setjmp/longjmp. >From C++: use exceptions >From Delphi: use exceptions Karl From regis.st-gelais at laubrass.com Tue Oct 28 20:10:30 2003 From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=) Date: Tue Oct 28 20:10:38 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? References: <20031028235818.E83FE89F@pehoe.civil.ist.utl.pt> Message-ID: <01dd01c39db9$7294a280$647ba8c0@regis> >>>So my question is: is there a way to abort the parsing from inside an >>>handler? Disabling the handlers does exactly what I need XML_SetElementHandler(xmlpParser, NULL, NULL); XML_SetCharacterDataHandler(xmlpParser, NULL); XML_SetProcessingInstructionHandler(xmlpParser, NULL); Thanks Fred, Carlos and Karl for your answers Regis From karl at waclawek.net Tue Oct 28 21:34:31 2003 From: karl at waclawek.net (Karl Waclawek) Date: Tue Oct 28 21:32:58 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? References: <20031028235818.E83FE89F@pehoe.civil.ist.utl.pt> <01dd01c39db9$7294a280$647ba8c0@regis> Message-ID: <000a01c39dc5$2f1c2e40$1f12fea9@karl> > >>>So my question is: is there a way to abort the parsing from inside an > >>>handler? > > Disabling the handlers does exactly what I need > XML_SetElementHandler(xmlpParser, NULL, NULL); > XML_SetCharacterDataHandler(xmlpParser, NULL); > XML_SetProcessingInstructionHandler(xmlpParser, NULL); But doesn't abort parsing! Karl From fdrake at acm.org Wed Oct 29 00:24:15 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Wed Oct 29 00:24:28 2003 Subject: [Expat-discuss] (no subject) In-Reply-To: References: Message-ID: <16287.20223.853381.271077@grendel.zope.com> Ponnusamy.Anand@choicepoint.com writes: > This is the application code (API) we use to parse the XML document. I can only guess what your actual character handler looks like, but I'd still guess that you're having exactly the problem I described earlier. Please review your code carefully, keeping in mind that each character could be reported to the application separately. (It normally won't be in practice, but it could be, depending on the input document.) -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake at acm.org Wed Oct 29 00:33:55 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Wed Oct 29 00:34:07 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? In-Reply-To: <20031028235818.E83FE89F@pehoe.civil.ist.utl.pt> References: <20031028235818.E83FE89F@pehoe.civil.ist.utl.pt> <01dd01c39db9$7294a280$647ba8c0@regis> Message-ID: <16287.20803.144904.780589@grendel.zope.com> Carlos Pereira writes: > What? aborting the parsing from inside a handler is easy, > you just have to do (for example, to disable ElementStart > and ElementEnd callbacks at once, when an error is found): As Karl noted, this doesn't actually stop processing. Expat isn't bothered by having no callbacks set; it's still bound to continue parsing to report well-formedness violations. So the document is still parsed, it's just that the application isn't bothered with the document content any longer. For small documents, this isn't generally a problem, especially if the entire document has already been loaded, or is at least available on a fast filesystem. For large documents, it can still require quite a bit of work (especially if namespaces are enabled). Adding a way to cancel parsing (or even "suspend" parsing) would allow an application to really stop processing an input document without delays. This can be important in some applications. > All of this works perfect even with unlimited external entities: > files calling others recursively (with sucessively new parsers) > without any limit on the number of nested levels... and > disabling/enabling callbacks automatically all the time ;-)... > it's fast and clean... Yes, it does; the real point is that Expat doesn't stop parsing. > This is in the manual, so I am fairly surprised... > Am I missing something? are we talking of different things? > I am sorry if that is the case... I think the above explanation makes sense; let me know if it doesn't. The approach of removing all callbacks and returning an error flag from the external entity reference handler is really a work-around for the lack of a real "stop parsing!" mechanism. That's what we intend to change for Expat 3.0; the ability to swap out handlers will remain. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From brox at corena.no Wed Oct 29 03:05:16 2003 From: brox at corena.no (Bjorn Brox) Date: Wed Oct 29 03:05:29 2003 Subject: [Expat-discuss] Abort parsing from inside an handler? In-Reply-To: <001601c39db1$e18e7dd0$1f12fea9@karl> References: <019301c39da3$894e3560$647ba8c0@regis> <001601c39db1$e18e7dd0$1f12fea9@karl> Message-ID: <3F9F74BC.3070704@corena.no> Karl Waclawek wrote: >>So my question is: is there a way to abort the parsing from inside an >>handler? > > >>From C: use setjmp/longjmp. >>From C++: use exceptions >>From Delphi: use exceptions > > Karl > To be more specific in 'c' #include ... static jmp_buf stop_jmp; ... static void StopParser(const char msg[]) { ... longjmp(stop_jmp, 0); } ... if (setjmp(stop_jmp) == 0) { for (;;) { xml_buf = XML_GetBuffer(parser, MY_XML_BUF_SIZE); bytes_read = fread(xml_buf, 1, MY_XML_BUF_SIZE, fp); if (bytes_read < 0) break; if (!XML_Parse(parser, xml_buf, bytes_read, bytes_read == 0)) { ... break; } if (bytes_read == 0) break; } } else { /* Ends up here if longjmp() is used */ } -- Bjorn Brox, CORENA Norge AS, http://www.corena.no/, ICQ 17872043 Industritunet, Dyrmyrgt. 35, N-3611 Kongsberg, NORWAY Phone: +47 32717210, Fax: +47 32717201, Mobile: +47 92638590 From regis.st-gelais at laubrass.com Wed Oct 29 07:31:08 2003 From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=) Date: Wed Oct 29 07:31:25 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? References: <20031028235818.E83FE89F@pehoe.civil.ist.utl.pt> <01dd01c39db9$7294a280$647ba8c0@regis> <000a01c39dc5$2f1c2e40$1f12fea9@karl> Message-ID: <001c01c39e18$87999960$647ba8c0@regis> ----- Original Message ----- From: Karl Waclawek >But doesn't abort parsing! If you look at my original posting, I use a flag to stop my main loop. QUOTE In my userdata structure I have: bool bolError In my elementstart handler, if I detect an error, I set bolError to true. In my main loop, after the XML_Parse call, I check the bolError flag and I stop the parsing if necessary. It work not so bad but the parsing does not stop immediately when I catch the error but when the current buffer sent to XML_Parse in completely parsed. END QUOTE The flag technic + desabling the handlers if enought for my needs, thanks. Regis From regis.st-gelais at laubrass.com Wed Oct 29 07:39:44 2003 From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=) Date: Wed Oct 29 07:40:00 2003 Subject: [Expat-discuss] (no subject) References: <16287.20223.853381.271077@grendel.zope.com> Message-ID: <002e01c39e19$bb2f5c00$647ba8c0@regis> >Fred wrote: > >I can only guess what your actual character handler looks like, but >I'd still guess that you're having exactly the problem I described >earlier. Please review your code carefully, keeping in mind that each >character could be reported to the application separately. (It >normally won't be in practice, but it could be, depending on the input >document.) > Having specials caracters in my xml file ( ", >, <, ...) I've notice in the begining of my experimentation with expat that each time the parser sees one of those caracter, it call the data handling routine. So it realy looks like P. Anand's probleme is , as you said, caused by a data handling routine that assume that it will receive only one call per string of data. Regis From klj at donnell.com Wed Oct 29 08:20:40 2003 From: klj at donnell.com (Ken Johnston) Date: Wed Oct 29 08:19:59 2003 Subject: [Expat-discuss] (no subject) In-Reply-To: Message-ID: <000201c39e1f$76634d60$1ec909c0@dev.donnell.com> > -----Original Message----- > From: expat-discuss-bounces@libexpat.org [mailto:expat-discuss- > bounces@libexpat.org] On Behalf Of Ponnusamy.Anand@choicepoint.com > Sent: Tuesday, October 28, 2003 4:34 PM > To: Fred L. Drake, Jr. > Cc: expat-discuss@libexpat.org > Subject: Re: [Expat-discuss] (no subject) > > /*---------------------------------------------------------------------- -- > ----*/ > void > XMLCharacterHandler(void *data, const char *s, int len) > { > trim_length_text((char *) s, &len); > > if (len) > { > elementvaluehandler(elementname, (char *) s, len); > /*---------------------------------------------------------------------- -- > ----*/ I'm not sure, but casting a constant char pointer and sending it to a function that modifies the string looks like trouble to me. > _______________________________________________ > Expat-discuss mailing list > Expat-discuss@libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss From karl at waclawek.net Tue Oct 28 17:38:25 2003 From: karl at waclawek.net (Karl Waclawek) Date: Wed Oct 29 08:50:53 2003 Subject: [Expat-discuss] Abort parsing from inside an handler? References: <019301c39da3$894e3560$647ba8c0@regis> Message-ID: <001301c39e23$a2c99630$9e539696@citkwaclaww2k> > Hi, > > Let say I'm inside the elementstart handler and I detect something wrong in > the file format. > I want to stop the parsing process. > > Right now I do the following: > > In my userdata structure I have: > bool bolError > > In my elementstart handler, if I detect an error, I set bolError to true. > > In my main loop, after the XML_Parse call, I check the bolError flag and I > stop the parsing if necessary. > > It work not so bad but the parsing does not stop immediately when I catch > the error but when the current buffer sent to XML_Parse in completely > parsed. > > So my question is: is there a way to abort the parsing from inside an > handler? Yes, use setjmp/longjmp when using C, or throw an exception when using a language that has exceptions. Karl From karl at waclawek.net Wed Oct 29 08:50:38 2003 From: karl at waclawek.net (Karl Waclawek) Date: Wed Oct 29 08:50:57 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? References: <20031028235818.E83FE89F@pehoe.civil.ist.utl.pt><01dd01c39db9$7294a280$647ba8c0@regis><000a01c39dc5$2f1c2e40$1f12fea9@karl> <001c01c39e18$87999960$647ba8c0@regis> Message-ID: <001401c39e23$a2eb4f00$9e539696@citkwaclaww2k> > ----- Original Message ----- > From: Karl Waclawek > > >But doesn't abort parsing! > > If you look at my original posting, I use a flag to stop my main loop. That still means it will continue parsing to the end of your current buffer. If the buffers you use are small, it may not make much of a difference. Karl From regis.st-gelais at laubrass.com Wed Oct 29 08:57:51 2003 From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=) Date: Wed Oct 29 08:58:44 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? References: <20031028235818.E83FE89F@pehoe.civil.ist.utl.pt> <01dd01c39db9$7294a280$647ba8c0@regis> <000a01c39dc5$2f1c2e40$1f12fea9@karl> <001c01c39e18$87999960$647ba8c0@regis> <001401c39e23$a2eb4f00$9e539696@citkwaclaww2k> Message-ID: <00af01c39e24$a4a9d270$647ba8c0@regis> ----- Original Message ----- From: Karl Waclawek To: R?gis St-Gelais ; expat-discuss@libexpat.org Sent: Wednesday, October 29, 2003 8:50 AM Subject: Re: [Expat-discuss] Re: Abort parsing from inside an handler? > ----- Original Message ----- > From: Karl Waclawek > > >But doesn't abort parsing! > > If you look at my original posting, I use a flag to stop my main loop. That still means it will continue parsing to the end of your current buffer. If the buffers you use are small, it may not make much of a difference. Karl I do have small buffers, The flag technic + desabling the handlers if enought for my needs, thanks. Regis From carlos at pehoe.civil.ist.utl.pt Wed Oct 29 09:21:04 2003 From: carlos at pehoe.civil.ist.utl.pt (Carlos Pereira) Date: Wed Oct 29 09:12:17 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? Message-ID: <20031029142104.1096A8A9@pehoe.civil.ist.utl.pt> >Carlos Pereira writes: > > What? aborting the parsing from inside a handler is easy, > > you just have to do (for example, to disable ElementStart > > and ElementEnd callbacks at once, when an error is found): >As Karl noted, this doesn't actually stop processing. Expat isn't >bothered by having no callbacks set; it's still bound to continue >parsing to report well-formedness violations. So the document is >still parsed, it's just that the application isn't bothered with the >document content any longer. >For small documents, this isn't generally a problem, especially if the >entire document has already been loaded, or is at least available on a >fast filesystem. For large documents, it can still require quite a >bit of work (especially if namespaces are enabled). The biggest files I tested so far have in excess of 290,000 lines, it takes about 50 sec in this 6-old machine to parse, check for a ton of possible errors, allocate memory, link everything, show with OpenGL, return control to Gtk, etc. If I have an error in the beginning of this file, Expat immediately returns control to me, in a fraction of a second, so the parsing is effectively disabled, no doubt about that! just to clarify my point, I added a printf ("hello\n"); in the very beginning of my handler, so if I import a file with 3 elements, I get 3 hello messages in stdout. Now if I have an error in the first element, detected by my own code, only one hello message goes to stdout, which proves that my handler has been efectively disabled. If there is a formation error in the first element, thus detected by Expat, then no hello message goes to stdout, as Expat stops parsing and does not send the wrong data to the handler (which is correct, of course). this prints 3 hello messages: this prints 1 hello message: (validation error, found by my code) this prints no hello message: (formation error, found by Expat) >That still means it will continue parsing to the end of your > current buffer. If the buffers you use are small, it may not > make much of a difference. I am parsing with blocks of BUFSIZ size, (about 8192, I think). When callbacks are disabled, perhaps Expat still reads the entire block, I don't know. Even if that is the case, the maxium delay we have is say 0.1 sec or less, the time to read the block, but not more... even in a relatively old machine as this... If someone is using much larger buffers than this, about several Megabytes, then I have to say that in my opinion that is plain wrong, and the error is in their code, not in Expat. It might be worth to optimize this in Expat, but even if everything goes fine, what we are going to gain is about 0.05 sec... for a BUFSIZ buffer, not more! at the price of making the whole code more complex, thus more bloated and perhaps slower... Carlos From karl at waclawek.net Wed Oct 29 09:22:06 2003 From: karl at waclawek.net (Karl Waclawek) Date: Wed Oct 29 09:22:19 2003 Subject: [Expat-discuss] Re: Abort parsing from inside an handler? References: <20031029142104.1096A8A9@pehoe.civil.ist.utl.pt> Message-ID: <002f01c39e28$08372ce0$9e539696@citkwaclaww2k> > I am parsing with blocks of BUFSIZ size, (about 8192, I think). > When callbacks are disabled, perhaps Expat still reads > the entire block, I don't know. Even if that is the case, the maxium > delay we have is say 0.1 sec or less, the time to read the block, > but not more... even in a relatively old machine as this... > > If someone is using much larger buffers than this, about > several Megabytes, then I have to say that in my opinion > that is plain wrong, and the error is in their code, not in Expat. The effect of buffer size is somewhat a mystery. One would think that larger buffers require less overhead, which is true, but with diminishing returns once the extra work of XML_Parse(Buffer) calls becomes small compared to the rest of buffer processing. I found the fastest buffer size for me (on Windows) was between 16KBytes and 128KBytes. Larger buffers tend to slow parsing down (a little), don't know why. > It might be worth to optimize this in Expat, but > even if everything goes fine, what we are going to gain > is about 0.05 sec... for a BUFSIZ buffer, not more! You are correct for stopping the parser, but for suspending it (not yet implemented) we need to stop immediately so that we don't skip any XML content. Karl From karam_chand02 at yahoo.com Thu Oct 30 01:30:36 2003 From: karam_chand02 at yahoo.com (Karam Chand) Date: Thu Oct 30 01:30:41 2003 Subject: [Expat-discuss] How to stop parsing after reaching a certain element Message-ID: <20031030063036.83889.qmail@web13102.mail.yahoo.com> Hello I have a big XML file to parse. I want to stop parsing after I have reached a certain element. How can I do it? I am using C++. startElementHandler nor endElementHandler has any return values that can tell the parser to stop parsing element? Thanks in advance. __________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ From fdrake at acm.org Thu Oct 30 01:38:35 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu Oct 30 01:38:48 2003 Subject: [Expat-discuss] How to stop parsing after reaching a certain element In-Reply-To: <20031030063036.83889.qmail@web13102.mail.yahoo.com> References: <20031030063036.83889.qmail@web13102.mail.yahoo.com> Message-ID: <16288.45547.695784.984230@grendel.zope.com> Karam Chand writes: > I have a big XML file to parse. I want to stop parsing > after I have reached a certain element. How can I do > it? > > I am using C++. startElementHandler nor > endElementHandler has any return values that can tell > the parser to stop parsing element? Expat 3.0 will require that callbacks return an XML_Status value to inform the parser how to proceed. With the current Expat and C++, you can raise a C++ exception to exit parsing. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From carlos at pehoe.civil.ist.utl.pt Thu Oct 30 06:03:50 2003 From: carlos at pehoe.civil.ist.utl.pt (Carlos Pereira) Date: Thu Oct 30 05:55:46 2003 Subject: [Expat-discuss] Re: How to stop parsing... Message-ID: <20031030110350.89C8886B@pehoe.civil.ist.utl.pt> >Karam Chand writes: > > I have a big XML file to parse. I want to stop parsing > > after I have reached a certain element. How can I do > > it? > > > > I am using C++. startElementHandler nor > > endElementHandler has any return values that can tell > > the parser to stop parsing element? > >Expat 3.0 will require that callbacks return an XML_Status value to >inform the parser how to proceed. > >With the current Expat and C++, you can raise a C++ exception to exit >parsing. In the present, you can do (at the end of the element callback): if (ml->my_flag == FALSE) XML_SetElementHandler (ml->parser, NULL, NULL); in the future, you can do (at the end of the element callback): return ml->my_flag; Not terribly different ;-) Carlos From karl at waclawek.net Thu Oct 30 09:59:01 2003 From: karl at waclawek.net (Karl Waclawek) Date: Thu Oct 30 09:59:09 2003 Subject: [Expat-discuss] How to stop parsing after reaching a certainelement References: <20031030063036.83889.qmail@web13102.mail.yahoo.com> <16288.45547.695784.984230@grendel.zope.com> Message-ID: <007e01c39ef6$5acf62f0$9e539696@citkwaclaww2k> > Karam Chand writes: > > I have a big XML file to parse. I want to stop parsing > > after I have reached a certain element. How can I do > > it? > > > > I am using C++. startElementHandler nor > > endElementHandler has any return values that can tell > > the parser to stop parsing element? > > Expat 3.0 will require that callbacks return an XML_Status value to > inform the parser how to proceed. > > With the current Expat and C++, you can raise a C++ exception to exit > parsing. Actually, I am currently working on a branch that allows aborting as well as suspending the parser. It does not require the call-backs to return a value. Here are the two new API functions: /* Stops parsing, causing XML_Parse/Buffer() to return as soon as possible. Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. Possible Error codes: XML_ERROR_SUSPENDED, XML_ERROR_FINISHED. When resumable = XML_TRUE then parsing is suspended, that is, XML_Parse/Buffer() returns XML_STATUS_SUSPENDED. Otherwise, parsing is aborted, that is, XML_Parse/Buffer() returns XML_STATUS_ERROR with error code XML_ERROR_ABORTED. Note: When suspended, parsing can be resumed by calling XML_ResumeParser(). */ XMLPARSEAPI(enum XML_Status) XML_StopParser(XML_Parser parser, XML_Bool resumable); /* Resumes parsing after it has been suspended with XML_StopParser(). Must not be called from within a handler call-back. Returns same status codes as XML_Parse/Buffer(). Additional error code XML_ERROR_NOT_SUSPENDED possible. */ XMLPARSEAPI(enum XML_Status) XML_ResumeParser(XML_Parser parser); It seems to work OK so far, but is not heavily tested and is not able to deal with suspending/resuming from within internal entities, but I am working on this. Karl From nate.yocom at xpasystems.com Thu Oct 30 11:57:35 2003 From: nate.yocom at xpasystems.com (Nathan Yocom) Date: Thu Oct 30 11:57:05 2003 Subject: [Expat-discuss] Character Conversion - Reinvent the wheel? Message-ID: <3FA142FF.3050603@xpasystems.com> Okay - forgive me if this has been asked, but searching around uncovered no obvious answers. I need to write a small C++ function that takes a string and returns it in valid format for use as an xml tag.. i.e. string convert(string value); wherein things like "<" would be replaced by "<" and so on. However, I can't help but feel like this has to have been done a thousand times, anyone have or know of a function like this they would be willing to share? Barring that, anyone have pointers as to where I can get a list of the conversions necessary so I can get them all? Thanks in advance, Nate Yocom nate.yocom@xpasystems.com