From joecosby_expat at hotmail.com Thu Jan 3 22:36:02 2008 From: joecosby_expat at hotmail.com (Joe Cosby) Date: Thu, 3 Jan 2008 13:36:02 -0800 Subject: [Expat-discuss] (no subject) Message-ID: I'm working on an application which will need to be able to read and parse XML files. I'm trying, as much as possible, to keep everything in the executable. I'd like the user to be able to just download the executable and run it and no more installation burden than that be necessary. I've downloaded the expat 2.0.1 distro and it builds very easily (I'm using MS Visual C++ 6) and I've set up a small test program which calls expat and that's easy enough. But I can't see a way to make it work without installing the DLL. Is it possible to just link the expat code into my application, without using the DLL? I talked to somebody on Usenet who said he linked with one of the libraries in the StaticLibs directory, but that this isn't provided in the 2.0.1 distro. I do have a directory \expat-2.0.1\win32\tmp\Debug_static which contains these object files: xmltok_ns.obj xmltok_impl.obj xmltok.obj xmlrole.obj xmlparse.obj I have used object files that way in the past, if you have the headers you can just use them sort of the way you would use Java class files, but at compile time ... It's been a while since I've done it that way but it's possible in theory. But I'm not sure if this is even possible the way expat is set up or what project/header files I would need to use. My test project is just this so far: #include #include "expat.h" int main(int argc, char *argv[]) { printf("Starting ...\r\n"); XML_Parser parser = XML_ParserCreate(NULL); XML_ParserFree(parser); return 0; } And that requires the DLL. There's also a directory expat-2.0.1\win32\bin\Debug which contains libexpatMT.lib and libexpatW.lib, and I'm thinking I might be able to link with these but again I am not sure how to set the project up. Anyway thanks for any help anybody can offer on this. I suppose it's not the end of the world if I just have to include the DLL with the project but I am trying to avoid that if I can. _________________________________________________________________ The best games are on Xbox 360. Click here for a special offer on an Xbox 360 Console. http://www.xbox.com/en-US/hardware/wheretobuy/ From webmaster at hartwork.org Thu Jan 3 23:45:20 2008 From: webmaster at hartwork.org (Sebastian Pipping) Date: Thu, 03 Jan 2008 23:45:20 +0100 Subject: [Expat-discuss] (no subject) In-Reply-To: References: Message-ID: <477D6580.8050009@hartwork.org> Joe Cosby wrote: > Is it possible to just link the expat code into my application, without using the DLL? yes. either link to static libraries or add all xml*.c files from the lib folder and define COMPILED_FROM_DSP. worked for me in a similar setup. sebastian From lee at novomail.net Thu Jan 3 23:25:19 2008 From: lee at novomail.net (Lee Passey) Date: Thu, 03 Jan 2008 15:25:19 -0700 Subject: [Expat-discuss] (no subject) In-Reply-To: References: Message-ID: <477D60CF.8040009@novomail.net> Joe Cosby wrote: [snip] > There's also a directory expat-2.0.1\win32\bin\Debug which contains > libexpatMT.lib and libexpatW.lib, and I'm thinking I might be able to > link with these but again I am not sure how to set the project up. 1. #define XML_STATIC for those portions of your source code that use expat. 2. Include expat.h from source/lib, as necessary. 3. Link to libexpatMT.lib in from StaticLibs for regular (ASCII, utf-8) programs or libexpatwMT.lib for ucs-2 (unicode, wide character) applications. There is no difference between libexpatMT.lib and libexpatML.lib. HTH From joecosby_expat at hotmail.com Fri Jan 4 16:07:12 2008 From: joecosby_expat at hotmail.com (Joe Cosby) Date: Fri, 4 Jan 2008 07:07:12 -0800 Subject: [Expat-discuss] static linking Message-ID: Thanks all for the help! > Subject: Re: [Expat-discuss] (no subject) > To: joecosby_expat at hotmail.com > CC: expat-discuss at libexpat.org > From: tyounger at questertangent.com > Date: Thu, 3 Jan 2008 13:51:29 -0800 > > I had the same question some time ago. Here's my question and the reply. > This solution worked for me. > > > Tom Younger wrote: >> Hi there. >> >> I have a question about linking. >> >> I would like to link the Expat library statically. When I link to the >> Linux libraries, this happens properly, however when I link my project >> under Windows, I can only get the program to work if I include the path > to >> the libexpat.dll in my system path. >> >> Even though I include StaticLibs\libexpatMT.lib in my link command, > without >> Libs\libexpat.lib, it can't resolve some symbols. It appears as though >> libexpat.lib loads the DLL at run-time. > For static linking you need to define a specific symbol. > If I remember correctly it is XML_STATIC. > > Karl > -- Joe Cosby http://joecosby.com/ "If God is male, and God is everywhere, does that mean His Penis is everywhere?" Which is a philosophical question just as well avoided, since that one inevitably leads to futile questions like "How do I keep God's Penis out of My Drink?" - Tesla Coil, alt.slack :: Currently listening to Dust Dawn (previously unissued alternative take), 1965, by John Coltrane, from "Kulu Se Mama (Juno Se Mama)" _________________________________________________________________ Get the power of Windows + Web with the new Windows Live. http://www.windowslive.com?ocid=TXT_TAGHM_Wave2_powerofwindows_012008 From mbuster at mchsi.com Tue Jan 8 16:01:47 2008 From: mbuster at mchsi.com (Mark Buster) Date: Tue, 08 Jan 2008 09:01:47 -0600 Subject: [Expat-discuss] Linux Arm & Expat Message-ID: <4783905B.8020907@mchsi.com> Hopefully this isn't too stupid of a request. I am new to cross compiling & linux in general. I have installed expat with the following sequence (hopefully correctly) as needed for my Cross compiler. Maybe this is where I'm lost.. ./configure --prefix=/usr/local/arm/3.4 --host=arm-linux CC=arm-linux-gcc make CC=arm-linux-gcc make install I am able to compile and link an example program like so: arm-linux-gcc ./outline.c -lexpat -o outline This compiles with no errors. When I transfer the executable over to the target and run it, I get the following error: " can't load library 'libexpat.so.1' " Now it is my understanding that this should have all been included during the build. Am I linking improperly? I'm not overly familiar with the process. Any help would be greatly appreciated. -- Mark Buster Systems Design & Consulting 217 Swan Street West Burlington, IA 52655 (319) 572-6617 mbuster at mchsi.com From rschiele at gmail.com Tue Jan 8 16:12:13 2008 From: rschiele at gmail.com (Robert Schiele) Date: Tue, 8 Jan 2008 16:12:13 +0100 Subject: [Expat-discuss] Linux Arm & Expat In-Reply-To: <4783905B.8020907@mchsi.com> References: <4783905B.8020907@mchsi.com> Message-ID: <20080108151213.GS30676@schiele.dyndns.org> On Tue, Jan 08, 2008 at 09:01:47AM -0600, Mark Buster wrote: > Hopefully this isn't too stupid of a request. > I am new to cross compiling & linux in general. > I have installed expat with the following sequence (hopefully correctly) > as needed for my Cross compiler. Maybe this is where I'm lost.. > > ./configure --prefix=/usr/local/arm/3.4 --host=arm-linux > CC=arm-linux-gcc make > CC=arm-linux-gcc make install > > I am able to compile and link an example program like so: > > arm-linux-gcc ./outline.c -lexpat -o outline > > This compiles with no errors. > When I transfer the executable over to the target and run it, I get the > following error: > > " can't load library 'libexpat.so.1' " > > Now it is my understanding that this should have all been included > during the build. Am I linking improperly? > I'm not overly familiar with the process. Any help would be greatly > appreciated. Obviously you also need to transfer the shared library itself to the target system. Either you put it into the default search path, or you set LD_LIBRARY_PATH to the location you put it, or you add the parameter "-rpath /foo/bar" to the link command where /foo/bar is the path you will put the library into. Robert -- Robert Schiele Dipl.-Wirtsch.informatiker mailto:rschiele at gmail.com "Quidquid latine dictum sit, altum sonatur." -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 194 bytes Desc: not available Url : http://mail.libexpat.org/pipermail/expat-discuss/attachments/20080108/e51343f3/attachment.pgp From zhongk2000 at gmail.com Thu Jan 10 11:32:35 2008 From: zhongk2000 at gmail.com (zhong kui) Date: Thu, 10 Jan 2008 18:32:35 +0800 Subject: [Expat-discuss] compile problem Message-ID: <1045caa00801100232u1a81d205o9598b5a34906db35@mail.gmail.com> I am trying to build expat for a PPCsystem than the system I am building this on. It appears that I am suppose to use the configure -- host=HOST option, but I don't really know what to put for HOST. The top of my toolchain is /opt/hardhat - however all of the toolchain bins are at "/opt/hardhat/devkit/ppc/405/bin" I am able to compile object files successfully, by simply redefining the CC variable as: COMPILER = /opt/hardhat/devkit/ppc/405/bin/ppc_405- PPC_INCLUDES = /opt/hardhat/devkit/ppc/405/target/usr/include CC = $(COMPILER)gcc CXX = $(COMPILER)g++ AR = $(COMPILER)ar LD = $(COMPILER)ld INCLUDES = -I$(srcdir)/lib -I$(PPC_INCLUDES) -I. .....and so on however, the linking seems to use the libtool defined by the LIBTOOL env variable, and ignores the "ld" definition above. Any help here would be appreciated... From zhongk2000 at gmail.com Thu Jan 10 11:54:42 2008 From: zhongk2000 at gmail.com (zhong kui) Date: Thu, 10 Jan 2008 18:54:42 +0800 Subject: [Expat-discuss] compile help Message-ID: <1045caa00801100254g72c08d2fk81ca984cee25d36@mail.gmail.com> I am trying to build expat for a PPC system by cross compiling. I am able to compile object files successfully, by simply redefining the CC variable as: CROSS_COMPILE=ppc_85xx- CC = $(CROSS_COMPILE)gcc CXX = $(CROSS_COMPILE)g++ LD = $(CROSS_COMPILE)ld AR = $(CROSS_COMPILE)ar AS = $(CROSS_COMPILE)as INCLUDES = -I$(srcdir)/lib -I$(PPC_INCLUDES) -I. LIBTOOL = $(SHELL) opt/eldk4.1/ppc_85xx/usr/bin/libtool .....and so on however, the linking seems to use the libtool defined by the LIBTOOL env variable, I get the following error during link: /bin/sh opt/eldk4.1/ppc_85xx/usr/bin/libtool --silent --mode=link --tag=ppc_85xx-gcc ppc_85xx-gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -no-undefined -version-info 6:0:5 -rpath /fileserver/zk/opt/eldk4.1/usr/lib -o libexpat.la lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo /usr/bin/ld: lib/.libs/xmlparse.o: Relocations in generic ELF (EM: 20) lib/.libs/xmlparse.o: could not read symbols: File in wrong format collect2: ld returned 1 exit status make: *** [libexpat.la] Error 1 Why does /usr/bin/ld come out? It should be ppc_85xx-ld... Any help here would be pretty appreciated... From matthias.jaeschke at nsn.com Fri Jan 11 08:04:29 2008 From: matthias.jaeschke at nsn.com (matthias.jaeschke at nsn.com) Date: Fri, 11 Jan 2008 09:04:29 +0200 Subject: [Expat-discuss] Export control classification number (ECC) for expat xml 1.95.8 In-Reply-To: <01BEAA3ADB26724D96F475520F6B73C5FBED21@esebe113.NOE.Nokia.com> References: <01BEAA3ADB26724D96F475520F6B73C5FBED21@esebe113.NOE.Nokia.com> Message-ID: <01BEAA3ADB26724D96F475520F6B73C501B47E0D@esebe113.NOE.Nokia.com> > Hi, > > We are using expat xml 1.95.8 in one of our products, and are now in the process of collecting the information needed to export it to other countries. > > Can you tell me what the U.S. Export Control Classification Number (ECCN) for expat XML is, and whether a license exception may be used for it? > > If you don't know the US ECCN, can you tell me whether any US citizens or people living in the U.S.A. have contributed code to expat XML 1.95.8? > > In addition to the U.S. ECCN, there is also a German "ECCN", which is called the AL Number. Can you tell me what the AL Number is for expat XML 1.95.8? > > To better understand the meaning of the U.S. ECCN, please check the following webpage: > http://www.bis.doc.gov/Licensing/Do_I_NeedAnECCN.html > > Many thanks, > Matthias J?schke > Nokia Siemens Networks > > Matthias J?schke > Senior Quality Engineer > > Nokia Siemens Networks Deutschland GmbH > Heltorfer Str. 1 > D-40472 D?sseldorf > Phone: +49-151-55153859 > Fax +49-211-9412-3383 > E-mail: matthias.jaeschke at nsn.com > > Sitz der Gesellschaft: Bochum / Registered office: Bochum > Registergericht: Bochum / Commercial registry: Bochum, HRB 11180 > Gesch?ftsf?hrung / Managing Directors: Dr. Ulrich Halka, Lydia Sommer > _________________________________________________ > Important Note: This e-mail and any attachment are confidential and may contain trade secrets and may well also be legally privileged or otherwise protected from disclosure. If you have received it in error, you are on notice of its status. Please notify us immediately by reply e-mail and then delete this e-mail and any attachment from your system. If you are not the intended recipient please understand that you must not copy this e-mail or any attachment or disclose the contents to any other person. Thank you for your cooperation. > > Wichtiger Hinweis: Dieses E-Mail und etwaige Anlagen k?nnen Betriebs- oder Gesch?ftsgeheimnisse, dem Anwaltsgeheimnis unterliegende oder sonstige vertrauliche Informationen enthalten. Sollten Sie dieses E-Mail irrt?mlich erhalten haben, ist Ihnen der Status dieses E-Mails bekannt. Bitte benachrichtigen Sie uns in diesem Fall sofort durch Antwort-Mail und l?schen Sie dieses E-Mail nebst etwaigen Anlagen von Ihrem System. Ebenso d?rfen Sie dieses E-Mail oder seine Anlagen nicht kopieren oder an Dritte weitergeben. Vielen Dank. > > From weigelt at metux.de Fri Jan 18 12:32:43 2008 From: weigelt at metux.de (Enrico Weigelt) Date: Fri, 18 Jan 2008 12:32:43 +0100 Subject: [Expat-discuss] Update on OSS-QM patchsets Message-ID: <20080118113243.GC11945@nibiru.local> Hi folks, JFYI: I've just updated the expat patchsets in the OSS-QM repository and ported the missing things (eg. autotools fixes, pkg-config descriptor, ...) to 2.0.1. cu -- --------------------------------------------------------------------- Enrico Weigelt == metux IT service - http://www.metux.de/ --------------------------------------------------------------------- Please visit the OpenSource QM Taskforce: http://wiki.metux.de/public/OpenSource_QM_Taskforce Patches / Fixes for a lot dozens of packages in dozens of versions: http://patches.metux.de/ --------------------------------------------------------------------- From weigelt at metux.de Fri Jan 18 12:27:10 2008 From: weigelt at metux.de (Enrico Weigelt) Date: Fri, 18 Jan 2008 12:27:10 +0100 Subject: [Expat-discuss] Statically linking against expat libs In-Reply-To: References: Message-ID: <20080118112709.GB11945@nibiru.local> * Dan Clusin wrote: Hi, > I'm trying to write a program that statically links against expat. The > target platform I am writing for is an embedded arm board running > embedded linux (using uClibc). When I compile my program using the > vendor provided tool-chain (gcc variant targeting the arm platform) I > get the following error: > > > /usr/local/arm/3.4/bin-ccache/../lib/gcc/arm-linux-uclibc/3.4.3/../../.. > /../arm-linux-uclibc/bin/ld: cannot find > -l/home/dclusin/Development/obvius_libs/expat/lib/libexpat.a Crosscompiling w/o sysroot ?! I suggest switching to an better toolchain ;-P > The libexpat.a archive does exist there. man 1 ld ;-P use -L to add an search path. (*before* the -l option) > ./configure --prefix=/home/dclusin/Development/obvius_libs/expat/ > --host=arm-linux-uclibc CC=/usr/local/arm/3.4/bin/arm-linux-gcc > LFLAGS=-s s/LFLAGS/LDFLAGS/; ? > The relevant section of my makefile is as follows: > > CC=/usr/local/arm/3.4/bin/arm-linux-gcc WTH do you have to touch the makefile instead of using env ? > LIBRARIES=-l$(OBVIUS_LIBS)/expat/lib/libexpat.a *lol* Wrong. "-l", NOT "-l" ;-P It's the linker's job to find out the correct library filenames. cu -- --------------------------------------------------------------------- Enrico Weigelt == metux IT service - http://www.metux.de/ --------------------------------------------------------------------- Please visit the OpenSource QM Taskforce: http://wiki.metux.de/public/OpenSource_QM_Taskforce Patches / Fixes for a lot dozens of packages in dozens of versions: http://patches.metux.de/ --------------------------------------------------------------------- From stefano.sabatini-lala at poste.it Mon Jan 21 12:31:33 2008 From: stefano.sabatini-lala at poste.it (Stefano Sabatini) Date: Mon, 21 Jan 2008 12:31:33 +0100 Subject: [Expat-discuss] How to fetch information for the position of each element in a file Message-ID: <20080121113133.GA32096@geppetto> Hi all, this is my first post here. I have an application which needs to parse an XML file, and I would like to print out the position of *each* element in the parsed file. Actually I slightly hacked outline.c to this: /*****************************************************************/ #include #include #define BUFFSIZE 8192 char Buff[BUFFSIZE]; int Depth; typedef struct UserData { char *filename; XML_Parser *p; } UserData; /* macro which defines the start handler for an element */ static void XMLCALL start(void *data, const char *el, const char **attr) { int i; UserData *user_data = (UserData *)data; /* indent according to the indentation depth */ for (i = 0; i < Depth; i++) printf(" "); printf("%s:%d:%s", user_data->filename, XML_GetCurrentLineNumber(user_data->parser), el) for (i = 0; attr[i]; i += 2) { printf(" %s='%s'", attr[i], attr[i + 1]); } printf("\n"); Depth++; } /* end handler */ static void XMLCALL end(void *data, const char *el) { Depth--; } int main(int argc, char *argv[]) { UserData data; XML_Parser parser = XML_ParserCreate(NULL); if (!parser) { fprintf(stderr, "Couldn't allocate memory for parser\n"); exit(-1); } /* set the start and end handler for each element of the document */ XML_SetElementHandler(parser, start, end); data.filename = "stdin"; data.parser = &parser; /* this sets the pointer to pass to the various handler function * you need to fill accordingly this struct */ XML_SetUserData(parser, &data); for (;;) { int done; int len; len = fread(Buff, 1, BUFFSIZE, stdin); if (ferror(stdin)) { fprintf(stderr, "Read error\n"); exit(-1); } done = feof(stdin); if (XML_Parse(parser, Buff, len, done) == XML_STATUS_ERROR) { fprintf(stderr, "Parse error at line %d:\n%s\n", XML_GetCurrentLineNumber(parser), XML_ErrorString(XML_GetErrorCode(parser))); exit(-1); } /* when it reads EOF then quit the loop */ if (done) break; } return 0; } /*****************************************************************/ The start element handler accesses the parser struct and calls on it the XML_GetCurrentLineNumber function: printf("%s:%d:%s", user_data->filename, XML_GetCurrentLineNumber(user_data->parser), el) Unfortunately this doesn't work, for example with this sample file: it is me, foo it is you, bar I get this output: $ cat sample.xml | outline-passing-data stdin:1:sample stdin:1:foo stdin:1:bar I wonder if there is some way to get the actual position for every parsed element, this seems a very reasonable request since such information could be used for example when performing the semantical analysis of the XML tree to print out where exactly happened a semantical error. Any help will be highly appreciated. Regards. -- Stefano Sabatini Linux user number 337176 (see http://counter.li.org) From stefano.sabatini-lala at poste.it Mon Jan 21 14:54:07 2008 From: stefano.sabatini-lala at poste.it (Stefano Sabatini) Date: Mon, 21 Jan 2008 14:54:07 +0100 Subject: [Expat-discuss] How to fetch information for the position of each element in a file In-Reply-To: <20080121113133.GA32096@geppetto> References: <20080121113133.GA32096@geppetto> Message-ID: <20080121135407.GA10064@geppetto> On date Monday 2008-01-21 12:31:33 +0100, Stefano Sabatini wrote: > Hi all, this is my first post here. > > I have an application which needs to parse an XML file, and I would > like to print out the position of *each* element in the parsed file. > > Actually I slightly hacked outline.c to this: Sorry to reply to self, the below code doesn't compile, and adequately fixed seems to work just right for what I wanted to do, I think I was compiling and running another program so I was getting wrong results. > /*****************************************************************/ > #include > #include > > #define BUFFSIZE 8192 > > char Buff[BUFFSIZE]; > > int Depth; > > typedef struct UserData { > char *filename; > XML_Parser *p; ^^ parser > } UserData; > > /* macro which defines the start handler for an element */ > static void XMLCALL > start(void *data, const char *el, const char **attr) > { > int i; > UserData *user_data = (UserData *)data; > > /* indent according to the indentation depth */ > for (i = 0; i < Depth; i++) > printf(" "); > > printf("%s:%d:%s", user_data->filename, XML_GetCurrentLineNumber(user_data->parser), el) ^^^^^^^^^^^^^^^^^^ * missing, and ';' at the end of line too. > for (i = 0; attr[i]; i += 2) { > printf(" %s='%s'", attr[i], attr[i + 1]); > } > > printf("\n"); > Depth++; > } > > /* end handler */ > static void XMLCALL > end(void *data, const char *el) > { > Depth--; > } > > int main(int argc, char *argv[]) > { > UserData data; > > XML_Parser parser = XML_ParserCreate(NULL); > if (!parser) { > fprintf(stderr, "Couldn't allocate memory for parser\n"); > exit(-1); > } > > /* set the start and end handler for each element of the document */ > XML_SetElementHandler(parser, start, end); > > data.filename = "stdin"; > data.parser = &parser; > > /* this sets the pointer to pass to the various handler function > * you need to fill accordingly this struct */ > XML_SetUserData(parser, &data); > > for (;;) { > int done; > int len; > > len = fread(Buff, 1, BUFFSIZE, stdin); > if (ferror(stdin)) { > fprintf(stderr, "Read error\n"); > exit(-1); > } > done = feof(stdin); > > if (XML_Parse(parser, Buff, len, done) == XML_STATUS_ERROR) { > fprintf(stderr, "Parse error at line %d:\n%s\n", > XML_GetCurrentLineNumber(parser), > XML_ErrorString(XML_GetErrorCode(parser))); > exit(-1); > } > > /* when it reads EOF then quit the loop */ > if (done) > break; > } > return 0; > } > /*****************************************************************/ > > The start element handler accesses the parser struct and calls on it the > XML_GetCurrentLineNumber function: > > printf("%s:%d:%s", user_data->filename, XML_GetCurrentLineNumber(user_data->parser), el) > > Unfortunately this doesn't work, for example with this sample file: > > > it is me, foo > it is you, bar > > > > I get this output: > $ cat sample.xml | outline-passing-data > stdin:1:sample > stdin:1:foo > stdin:1:bar > > I wonder if there is some way to get the actual position for every > parsed element, this seems a very reasonable request since such > information could be used for example when performing the semantical > analysis of the XML tree to print out where exactly happened a > semantical error. > > Any help will be highly appreciated. With these simple correction the program seems to behave correctly, that is it prints the correct position of the beginning of each element, so I get for example: $ cat sample.xml | outline2 stdin:1:sample stdin:3:foo stdin:4:bar Sorry for the noise, regards. -- Stefano Sabatini Linux user number 337176 (see http://counter.li.org)