From alexander.indenbaum at gmail.com Thu Feb 3 19:08:29 2005 From: alexander.indenbaum at gmail.com (Alexander Indenbaum) Date: Thu Feb 3 19:15:45 2005 Subject: [Expat-discuss] iso-8859-1 "unknown encoding" ? Message-ID: Hello, I'm new to expat and doing something basically wrong :{) I'm using expat-2005-01-28. I've created parser with XML_ParserCreate(NULL) and simple element start and end handlers. When I'm passing "iso-8859-1" xml buffer to XML_Parse() I'm getting error 18 ( unknown encoding ). BTW xml without encoding specification parsed just fine. What am I doing wrong? How should I handle the xml if I do not know from the beginning what kind on encoding it will use? Thanks in advance for your help, Alexander Indenbaum From karl at waclawek.net Thu Feb 3 19:24:41 2005 From: karl at waclawek.net (Karl Waclawek) Date: Thu Feb 3 19:24:52 2005 Subject: [Expat-discuss] iso-8859-1 "unknown encoding" ? In-Reply-To: References: Message-ID: <42026C69.7060004@waclawek.net> Alexander Indenbaum wrote: > Hello, > > I'm new to expat and doing something basically wrong :{) > > I'm using expat-2005-01-28. I've created parser with > XML_ParserCreate(NULL) and simple element start and end handlers. > When I'm passing "iso-8859-1" xml buffer to XML_Parse() I'm getting > error 18 ( unknown encoding ). BTW xml without encoding specification > parsed just fine. > > What am I doing wrong? > How should I handle the xml if I do not know from the beginning what > kind on encoding it will use? You only need to specify an encoding if the document does not have an XML declaration (with a specified encoding) and the actual encoding is not UTF-8, so that you have to force the parser to treat it a specific way. For real unusual encodings you may have to do that as well, since the parser may not be able to read the XML declaration. Karl From alexander.indenbaum at gmail.com Thu Feb 3 20:11:07 2005 From: alexander.indenbaum at gmail.com (Alexander Indenbaum) Date: Thu Feb 3 20:12:30 2005 Subject: [Expat-discuss] iso-8859-1 "unknown encoding" ? In-Reply-To: <42026C69.7060004@waclawek.net> References: <42026C69.7060004@waclawek.net> Message-ID: Karl, Thanks for such a fast response, but I did not get it. Why do I get parse error 18 ( unknown encoding ) for XML declared as "iso-8859-1"? How can I get such a xml parsed? Alexander Indenbaum. On Thu, 03 Feb 2005 13:24:41 -0500, Karl Waclawek wrote: > Alexander Indenbaum wrote: > > Hello, > > > > I'm new to expat and doing something basically wrong :{) > > > > I'm using expat-2005-01-28. I've created parser with > > XML_ParserCreate(NULL) and simple element start and end handlers. > > When I'm passing "iso-8859-1" xml buffer to XML_Parse() I'm getting > > error 18 ( unknown encoding ). BTW xml without encoding specification > > parsed just fine. > > > > What am I doing wrong? > > How should I handle the xml if I do not know from the beginning what > > kind on encoding it will use? > > You only need to specify an encoding if the document does not have > an XML declaration (with a specified encoding) and the actual > encoding is not UTF-8, so that you have to force the parser to treat > it a specific way. For real unusual encodings you may have to do > that as well, since the parser may not be able to read the XML declaration. > > Karl > From karl at waclawek.net Thu Feb 3 20:19:56 2005 From: karl at waclawek.net (Karl Waclawek) Date: Thu Feb 3 20:20:01 2005 Subject: [Expat-discuss] iso-8859-1 "unknown encoding" ? In-Reply-To: References: <42026C69.7060004@waclawek.net> Message-ID: <4202795C.3010207@waclawek.net> Alexander Indenbaum wrote: > Karl, > > Thanks for such a fast response, but I did not get it. > > Why do I get parse error 18 ( unknown encoding ) for XML declared as > "iso-8859-1"? > How can I get such a xml parsed? Does the XML document contain an XML declaration? If yes, maybe try ISO-8859-1 instead of iso-8859-1. I am not sure, but it could be that encoding ids are case-sensitive. Expat should understand it. Karl From alexander.indenbaum at gmail.com Thu Feb 3 20:29:50 2005 From: alexander.indenbaum at gmail.com (Alexander Indenbaum) Date: Thu Feb 3 20:30:40 2005 Subject: [Expat-discuss] iso-8859-1 "unknown encoding" ? In-Reply-To: <4202795C.3010207@waclawek.net> References: <42026C69.7060004@waclawek.net> <4202795C.3010207@waclawek.net> Message-ID: Karl, This is XML generated by third party, so I can not really change it. Is there a way to tell expat to continue even if it thinks that encoding declaration is invalid? Can I hint expat to use ISO-8859-1 when iso-8859-1 encoding declared? Alexander Indenbaum. On Thu, 03 Feb 2005 14:19:56 -0500, Karl Waclawek wrote: > Alexander Indenbaum wrote: > > Karl, > > > > Thanks for such a fast response, but I did not get it. > > > > Why do I get parse error 18 ( unknown encoding ) for XML declared as > > "iso-8859-1"? > > How can I get such a xml parsed? > > Does the XML document contain an XML declaration? > If yes, maybe try ISO-8859-1 instead of iso-8859-1. > I am not sure, but it could be that encoding ids are case-sensitive. > Expat should understand it. > > Karl > From fdrake at acm.org Thu Feb 3 20:36:04 2005 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu Feb 3 20:36:15 2005 Subject: [Expat-discuss] iso-8859-1 "unknown encoding" ? In-Reply-To: <4202795C.3010207@waclawek.net> References: <4202795C.3010207@waclawek.net> Message-ID: <200502031436.04444.fdrake@acm.org> On Thursday 03 February 2005 14:19, Karl Waclawek wrote: > I am not sure, but it could be that encoding ids are case-sensitive. > Expat should understand it. The XML 1.0 specification says in section 4.3.3: "XML processors SHOULD match character encoding names in a case-insensitive way". If we're not doing that, it's almost a bug, but I'll admit I use lower-case consistently. I consider a "SHOULD" to be quite important. -Fred -- Fred L. Drake, Jr. From karl at waclawek.net Thu Feb 3 20:48:54 2005 From: karl at waclawek.net (Karl Waclawek) Date: Thu Feb 3 20:49:12 2005 Subject: [Expat-discuss] iso-8859-1 "unknown encoding" ? In-Reply-To: <200502031436.04444.fdrake@acm.org> References: <4202795C.3010207@waclawek.net> <200502031436.04444.fdrake@acm.org> Message-ID: <42028026.4060509@waclawek.net> Fred L. Drake, Jr. wrote: > On Thursday 03 February 2005 14:19, Karl Waclawek wrote: > > I am not sure, but it could be that encoding ids are case-sensitive. > > Expat should understand it. > > The XML 1.0 specification says in section 4.3.3: "XML processors SHOULD match > character encoding names in a case-insensitive way". > > If we're not doing that, it's almost a bug, but I'll admit I use lower-case > consistently. I consider a "SHOULD" to be quite important. From the code it looks like Expat does it case-insensitive (function streqci). So, Alexander's file should work. Alexander, please e-mail us a small example document. Karl From alexander.indenbaum at gmail.com Sun Feb 6 16:58:28 2005 From: alexander.indenbaum at gmail.com (Alexander Indenbaum) Date: Sun Feb 6 16:58:31 2005 Subject: [Expat-discuss] ASCII "unknown encoding" [WAS: iso-8859-1 "unknown encoding" ?] In-Reply-To: References: <4202795C.3010207@waclawek.net> <200502031436.04444.fdrake@acm.org> <42028026.4060509@waclawek.net> Message-ID: Hello, I re-checked and it looks I dis-informed you. The declared encoding was "ASCII" and not "iso-8859-1". According to IANA ( http://www.iana.org/assignments/character-sets ) ASCII is a valid alias to ANSI_X3.4-1968, yet it still returns error 18 ( unknown encoding ). I solved the problem by defining and registering following unknown encoding handler: 99 // Assume unknown is ASCII 100 static int unknownEncodingHandler(void *pData, const char *pchName, XML_ Encoding *info) 101 { 102 for(int i=0; i<256; i++) { 103 info->map[i] = i; 104 } 105 info->data = 0; 106 info->convert = 0; 107 info->release = 0; 108 return 1; 109 } Anyway this implementation works, but does not look optimal from performance point of view, because it has to fill the info->map array per parse run. Q: Is there a way to say to expat library that when XML declared as "ASCII" it should use standard expat static and pre-defined ASCII encoding, without building the trivial dynamic XML_ Encoding struct on the fly by defining unknown encoding handler? Thanks in advance, Alexander Indenbaum On Thu, 03 Feb 2005 14:48:54 -0500, Karl Waclawek wrote: > Fred L. Drake, Jr. wrote: > > On Thursday 03 February 2005 14:19, Karl Waclawek wrote: > > > I am not sure, but it could be that encoding ids are case-sensitive. > > > Expat should understand it. > > > > The XML 1.0 specification says in section 4.3.3: "XML processors SHOULD match > > character encoding names in a case-insensitive way". > > > > If we're not doing that, it's almost a bug, but I'll admit I use lower-case > > consistently. I consider a "SHOULD" to be quite important. > > From the code it looks like Expat does it case-insensitive (function streqci). > So, Alexander's file should work. Alexander, please e-mail us a small example document. > > Karl > > From karl at waclawek.net Sun Feb 6 17:48:01 2005 From: karl at waclawek.net (Karl Waclawek) Date: Sun Feb 6 17:48:01 2005 Subject: [Expat-discuss] Re: ASCII "unknown encoding" [WAS: iso-8859-1 "unknown encoding" ?] In-Reply-To: References: <4202795C.3010207@waclawek.net> <200502031436.04444.fdrake@acm.org> <42028026.4060509@waclawek.net> Message-ID: <42064A41.7010907@waclawek.net> Alexander Indenbaum wrote: > Hello, > > I re-checked and it looks I dis-informed you. The declared encoding > was "ASCII" and not "iso-8859-1". > > > According to IANA ( http://www.iana.org/assignments/character-sets ) > ASCII is a valid alias to ANSI_X3.4-1968, yet it still returns error > 18 ( unknown encoding ). > According to the docs, Expat unserstands the name US-ASCII, which is also the preferred name used by IANA. Expat does not try to understand all IANA aliases for a specific encoding. Also, technically speaking, US-ASCII is a subset of UTF-8 and therefore you don't even need an encoding declaration. In your case, if the document is declared as "ASCII" and you can't change that, just force Expat to treat it as "US-ASCII". This is done by passing an encoding name to XML_ParserCreate. Karl From alexander.indenbaum at gmail.com Mon Feb 7 12:50:30 2005 From: alexander.indenbaum at gmail.com (Alexander Indenbaum) Date: Mon Feb 7 12:50:35 2005 Subject: [Expat-discuss] Re: ASCII "unknown encoding" [WAS: iso-8859-1 "unknown encoding" ?] In-Reply-To: <42064A41.7010907@waclawek.net> References: <4202795C.3010207@waclawek.net> <200502031436.04444.fdrake@acm.org> <42028026.4060509@waclawek.net> <42064A41.7010907@waclawek.net> Message-ID: Karl, Passing explicit "US-ASCII" encoding to XML_ParserCreate() as you suggested did the trick. I should have RTFMed more :{). Many thanks, Alexander Indenbaum On Sun, 06 Feb 2005 11:48:01 -0500, Karl Waclawek wrote: > > > Alexander Indenbaum wrote: > > Hello, > > > > I re-checked and it looks I dis-informed you. The declared encoding > > was "ASCII" and not "iso-8859-1". > > > > > > According to IANA ( http://www.iana.org/assignments/character-sets ) > > ASCII is a valid alias to ANSI_X3.4-1968, yet it still returns error > > 18 ( unknown encoding ). > > > > According to the docs, Expat unserstands the name US-ASCII, which is > also the preferred name used by IANA. Expat does not try to understand > all IANA aliases for a specific encoding. Also, technically speaking, > US-ASCII is a subset of UTF-8 and therefore you don't even need > an encoding declaration. > > In your case, if the document is declared as "ASCII" and you can't > change that, just force Expat to treat it as "US-ASCII". > This is done by passing an encoding name to XML_ParserCreate. > > Karl > From post at uwesalomon.de Mon Feb 7 20:15:11 2005 From: post at uwesalomon.de (Uwe Salomon) Date: Mon Feb 7 20:15:18 2005 Subject: [Expat-discuss] Sizes of GetCurrentByteIndex() and friends Message-ID: Hi, a few days before I decided to use Expat as the parser for my own project. When I looked over the documentation, (which is really good, I must say) I wondered why the return types of XML_GetCurrentByteIndex() XML_GetCurrentLineNumber() XML_GetCurrentColumnNumber() are so small. int is guaranteed to have 2 bytes (well, on most platforms it has 4), but shouldn't it be a long then for lineNumber() and columnNumber()? 32000 lines are not soo much. And the byteIndex() should be a long long, i think. Perhaps version 2.0 is a good opportunity to add these changes for the functions (and the underlying data structures as well, of course). By the way, great work this library... Ciao uwe From post at uwesalomon.de Mon Feb 7 22:09:32 2005 From: post at uwesalomon.de (Uwe Salomon) Date: Mon Feb 7 22:09:36 2005 Subject: [Expat-discuss] Getting the handlers Message-ID: Hi! Well, there is another request I want to make: For writing wrappers it would be quite useful if I could get the current handlers that are installed. In detail I would need the following: void XML_GetHandlers(XML_Parser*, SomeStruct* containsAllHandlerPointers); void XML_SetHandlers(XML_Parser*, SomeStruct* containsAllHandlerPointers); void XML_ClearHandlers(XML_Parser*); /* for convenience */ Or something similar. They would make it possible that a wrapper could "install" himself on the parser and fetch the events he wants to, and "uninstall" after he's done. Of course there are also other possibilities. So please tell me if I'm running in the wrong direction. :) Ciao uwe From semmons at sensorlogic.com Tue Feb 8 14:57:36 2005 From: semmons at sensorlogic.com (Steve Emmons) Date: Tue Feb 8 14:57:47 2005 Subject: [Expat-discuss] Well-formed XML question Message-ID: <20050208135745.E9E0F1E4009@bag.python.org> (Sorry if this is a duplicate. My first message appears to have bounced.) I'm working with a remote XML source that is sending me messages like this: Note that there is no space between the end of a quoted string and the beginning of the next attribute. I'm told this is "well-formed" by provider, but EXPAT doesn't like it. I can understand the argument that it is OK because the quote provides a delimiter that helps distinguish the tokens. An Open Source Java library called KXML apparently thinks this form is just fine. Is EXPAT too restrictive? Can it be made to relax this constraint? (I don't have control over the source, so I need to figure out how to consume it.) Thanks. -SE- From karl at waclawek.net Tue Feb 8 16:01:19 2005 From: karl at waclawek.net (Karl Waclawek) Date: Tue Feb 8 16:01:24 2005 Subject: [Expat-discuss] Well-formed XML question In-Reply-To: <20050208135745.E9E0F1E4009@bag.python.org> References: <20050208135745.E9E0F1E4009@bag.python.org> Message-ID: <4208D43F.2040006@waclawek.net> Steve Emmons wrote: > name="requestPercept"seq="3"/> > > > > Note that there is no space between the end of a quoted string and the > beginning of the next attribute. I'm told this is "well-formed" by provider, > but EXPAT doesn't like it. I can understand the argument that it is OK > because the quote provides a delimiter that helps distinguish the tokens. An > Open Source Java library called KXML apparently thinks this form is just > fine. > > > > Is EXPAT too restrictive? Can it be made to relax this constraint? (I don't > have control over the source, so I need to figure out how to consume it.) Expat is right. Check out http://www.w3.org/TR/REC-xml/#sec-starttags . Karl From post at uwesalomon.de Tue Feb 8 22:09:50 2005 From: post at uwesalomon.de (Uwe Salomon) Date: Tue Feb 8 22:09:53 2005 Subject: [Expat-discuss] Re: Getting the handlers In-Reply-To: References: Message-ID: > void XML_GetHandlers(XML_Parser*, SomeStruct* > containsAllHandlerPointers); > void XML_SetHandlers(XML_Parser*, SomeStruct* > containsAllHandlerPointers); > void XML_ClearHandlers(XML_Parser*); /* for convenience */ After some thinking about that I found that it is much better to change my program than to change your API. Sorry for the noise. Another question: There are some comments in your docs that you plan to change some things for 2.0 (for example the parameter of the XML_ExternalEntityRefHandler). How are plans about that now? Ciao uwe From karl at waclawek.net Wed Feb 9 00:24:36 2005 From: karl at waclawek.net (Karl Waclawek) Date: Wed Feb 9 00:24:34 2005 Subject: [Expat-discuss] Re: Getting the handlers In-Reply-To: References: Message-ID: <42094A34.2020109@waclawek.net> Uwe Salomon wrote: > Another question: There are some comments in your docs that you plan to > change some things for 2.0 (for example the parameter of the > XML_ExternalEntityRefHandler). How are plans about that now? The plans are for the releases *after* 2.0. We have no breaking changes planned for the upcoming Expat 2.0. Karl From semmons at sensorlogic.com Tue Feb 8 14:36:21 2005 From: semmons at sensorlogic.com (Steve Emmons) Date: Wed Feb 9 07:46:06 2005 Subject: [Expat-discuss] Well-formed XML question Message-ID: <20050208133629.3C3A21E4009@bag.python.org> I'm working with a remote XML source that is sending me messages like this: Note that there is no space between the end of a quoted string and the beginning of the next attribute. I'm told this is "well-formed" by provider, but EXPAT doesn't like it. I can understand the argument that it is OK because the quote provides a delimiter that helps distinguish the tokens. An Open Source Java library called KXML apparently thinks this form is just fine. Is EXPAT too restrictive? Can it be made to relax this constraint? (I don't have control over the source, so I need to figure out how to consume it.) Thanks. -SE- From hdong at cogentsystems.com Fri Feb 11 21:41:02 2005 From: hdong at cogentsystems.com (Howard Dong) Date: Fri Feb 11 21:41:49 2005 Subject: [Expat-discuss] question: dose expat support XSD? Message-ID: <0B8704EE67F3D74BA762FC76DA5EC4415D75D8@perseus.cogentinternal.com> I know it supports DTD, but how about XSD? If not, any idea to add this in? thanks a lot, Howard From karl at waclawek.net Fri Feb 11 21:48:59 2005 From: karl at waclawek.net (Karl Waclawek) Date: Fri Feb 11 21:49:11 2005 Subject: [Expat-discuss] question: dose expat support XSD? In-Reply-To: <0B8704EE67F3D74BA762FC76DA5EC4415D75D8@perseus.cogentinternal.com> References: <0B8704EE67F3D74BA762FC76DA5EC4415D75D8@perseus.cogentinternal.com> Message-ID: <420D1A3B.6000107@waclawek.net> Howard Dong wrote: > I know it supports DTD, but how about XSD? If not, any idea to add this in? > Expat does not support valiation, not even for DTDs. It just processes DTDs, reporting all declarations and using attribute and entity declarations for attribute defaulting and entity replacement in the document. Karl From hdong at cogentsystems.com Fri Feb 11 21:59:01 2005 From: hdong at cogentsystems.com (Howard Dong) Date: Fri Feb 11 21:59:05 2005 Subject: [Expat-discuss] question: dose expat support XSD? Message-ID: <0B8704EE67F3D74BA762FC76DA5EC4415D75DC@perseus.cogentinternal.com> Hi Karl, thanks for clarification. One more question: I am doing some stuff to convert between the non-XML data(you can imagine as a text document) and XML. My approach is: try to fill in the XML_ParserStruct with the information from text, and call the XML_Parse to generate a XML file. On the other hand, I want to read XML_ParserStruct and extract them and generate my own text file. But it seems XML_ParserStruct is not a tree to hold the information it has just passed -- forget about the memory first, do you know how to do it? thanks for your help, Howard -----Original Message----- From: Karl Waclawek [mailto:karl@waclawek.net] Sent: Friday, February 11, 2005 12:49 PM To: Howard Dong Cc: expat-discuss@libexpat.org Subject: Re: [Expat-discuss] question: dose expat support XSD? Howard Dong wrote: > I know it supports DTD, but how about XSD? If not, any idea to add this in? > Expat does not support valiation, not even for DTDs. It just processes DTDs, reporting all declarations and using attribute and entity declarations for attribute defaulting and entity replacement in the document. Karl From karl at waclawek.net Fri Feb 11 22:03:16 2005 From: karl at waclawek.net (Karl Waclawek) Date: Fri Feb 11 22:03:20 2005 Subject: [Expat-discuss] question: dose expat support XSD? In-Reply-To: <0B8704EE67F3D74BA762FC76DA5EC4415D75DC@perseus.cogentinternal.com> References: <0B8704EE67F3D74BA762FC76DA5EC4415D75DC@perseus.cogentinternal.com> Message-ID: <420D1D94.6060905@waclawek.net> Howard Dong wrote: > Hi Karl, > > thanks for clarification. > > One more question: > > I am doing some stuff to convert between the non-XML data(you can imagine as a text document) > and XML. My approach is: try to fill in the XML_ParserStruct with the information from text, > and call the XML_Parse to generate a XML file. On the other hand, I want to read > XML_ParserStruct and extract them and generate my own text file.> > But it seems XML_ParserStruct is not a tree to hold the information it has just passed > -- forget about the memory first, do you know how to do it? Expat can only read XML files, but not generate them. Karl From post at uwesalomon.de Wed Feb 16 19:07:41 2005 From: post at uwesalomon.de (Uwe Salomon) Date: Wed Feb 16 19:07:45 2005 Subject: [Expat-discuss] Slightly incorrect type in XML_StartElementHandler Message-ID: Hi, i think XML_StartElementHandler should be defined the following way: typedef void (XMLCALL *XML_StartElementHandler)(void *userData, const XML_Char *name, const XML_Char *const *atts); Notice the additional 'const' in the third parameter. I know it is a little finicky, but otherwise one can modify the pointer array. Ciao uwe From bony_limas at hotmail.com Thu Feb 17 04:06:06 2005 From: bony_limas at hotmail.com (Bony Limas) Date: Thu Feb 17 04:07:05 2005 Subject: [Expat-discuss] (no subject) Message-ID: I am new to unix CC compiler. My boss asked me to use Expat for XML parser. I successfully installed Expat on the Sun solaris. The problem is I cannot compile program which I include expat.h. The error message is likely to be: [585] $ CC readxml.cpp Undefined first referenced symbol in file XML_ParserCreate readxml.o ld: fatal: Symbol referencing errors. No output written to a.out What should I do to make it work? My Boss told me to link it with the library.. ?? How ?? Thank’s Bony _________________________________________________________________ Need a credit card fast? Apply now! Must be over 18. AU only: http://ad.au.doubleclick.net/clk;11046970;10638934;f?http://www.anz.com/aus/promo/first0105ninemsn/default.asp From bony_limas at hotmail.com Thu Feb 17 04:28:45 2005 From: bony_limas at hotmail.com (Bony Limas) Date: Thu Feb 17 04:29:05 2005 Subject: [Expat-discuss] Compile program (newbie) pls help ! Message-ID: I tried using this command CC -o readxml readxml.cpp /u/blimas/expat/lib/libexpat.so -L/u/blimas/expat/lib and the error now is like: Undefined first referenced symbol in file __eprintf /u/blimas/expat/lib/libexpat.so ld: fatal: Symbol referencing errors. No output written to readxml Anyone knows how to solve it ? Thank's in advance Bony _________________________________________________________________ SEEK: Now with over 60,000 dream jobs! Click here: http://ninemsn.seek.com.au?hotmail From fdrake at acm.org Thu Feb 17 04:21:58 2005 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu Feb 17 15:38:20 2005 Subject: [Expat-discuss] (no subject) In-Reply-To: References: Message-ID: <200502162221.29775.fdrake@acm.org> On Wednesday 16 February 2005 22:06, Bony Limas wrote: > I am new to unix CC compiler. My boss asked me to use Expat for XML > parser. I successfully installed Expat on the Sun solaris. > > The problem is I cannot compile program which I include expat.h. ... > What should I do to make it work? My Boss told me to link it with the > library.. ?? How ?? Your boss is right. Read the documentation on your compiler. It'll be worth the time spent. -Fred -- Fred L. Drake, Jr. From rizwan at advcomm.net Tue Feb 22 15:29:20 2005 From: rizwan at advcomm.net (Muhammad Rizwan Khan) Date: Tue Feb 22 15:29:41 2005 Subject: [Expat-discuss] how to compile Message-ID: <1109082560.7551.2.camel@Rizwan> Hello I have just installed expat on my system. When i tried to compile the program given in the example directory provided with the distribution, im getting the following error message: [root@Rizwan examples]# gcc elements.c /tmp/cceoXODZ.o(.text+0x80): In function `main': : undefined reference to `XML_ParserCreate' /tmp/cceoXODZ.o(.text+0xa8): In function `main': : undefined reference to `XML_SetUserData' /tmp/cceoXODZ.o(.text+0xc3): In function `main': : undefined reference to `XML_SetElementHandler' /tmp/cceoXODZ.o(.text+0x11c): In function `main': : undefined reference to `XML_Parse' /tmp/cceoXODZ.o(.text+0x131): In function `main': : undefined reference to `XML_GetCurrentLineNumber' /tmp/cceoXODZ.o(.text+0x143): In function `main': : undefined reference to `XML_GetErrorCode' /tmp/cceoXODZ.o(.text+0x14c): In function `main': : undefined reference to `XML_ErrorString' /tmp/cceoXODZ.o(.text+0x18a): In function `main': : undefined reference to `XML_ParserFree' collect2: ld returned 1 exit status Can you please guide me, what i need to do in order to compile this program. Thanks From Greg.Martin at TELUS.COM Tue Feb 22 18:32:01 2005 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Tue Feb 22 18:32:04 2005 Subject: [Expat-discuss] how to compile Message-ID: <87E369A7FEF45C4D9980D1E99A74C8BD15C606@BCMSG110.corp.ads> You need to tell gcc to use libexpat when it links (e.g. -lexpat). Usually a good idea to add the link instruction at the end. gcc elements.c -lexpat > -----Original Message----- > From: expat-discuss-bounces@libexpat.org > [mailto:expat-discuss-bounces@libexpat.org] On Behalf Of > Muhammad Rizwan Khan > Sent: Tuesday, February 22, 2005 7:29 AM > To: expat-discuss@libexpat.org > Subject: [Expat-discuss] how to compile > > Hello > > I have just installed expat on my system. When i tried to > compile the program given in the example directory provided > with the distribution, im getting the following error message: > > [root@Rizwan examples]# gcc elements.c > /tmp/cceoXODZ.o(.text+0x80): In function `main': > : undefined reference to `XML_ParserCreate' > /tmp/cceoXODZ.o(.text+0xa8): In function `main': > : undefined reference to `XML_SetUserData' > /tmp/cceoXODZ.o(.text+0xc3): In function `main': > : undefined reference to `XML_SetElementHandler' > /tmp/cceoXODZ.o(.text+0x11c): In function `main': > : undefined reference to `XML_Parse' > /tmp/cceoXODZ.o(.text+0x131): In function `main': > : undefined reference to `XML_GetCurrentLineNumber' > /tmp/cceoXODZ.o(.text+0x143): In function `main': > : undefined reference to `XML_GetErrorCode' > /tmp/cceoXODZ.o(.text+0x14c): In function `main': > : undefined reference to `XML_ErrorString' > /tmp/cceoXODZ.o(.text+0x18a): In function `main': > : undefined reference to `XML_ParserFree' > collect2: ld returned 1 exit status > > Can you please guide me, what i need to do in order to > compile this program. > > Thanks > > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss@libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss > From rizwan at advcomm.net Wed Feb 23 10:45:31 2005 From: rizwan at advcomm.net (Muhammad Rizwan Khan) Date: Wed Feb 23 10:45:55 2005 Subject: [Expat-discuss] how to compile In-Reply-To: <87E369A7FEF45C4D9980D1E99A74C8BD15C606@BCMSG110.corp.ads> References: <87E369A7FEF45C4D9980D1E99A74C8BD15C606@BCMSG110.corp.ads> Message-ID: <1109151931.4714.2.camel@Rizwan> Thanks for your help. Program is running but the problem is i can't run it. Whenever i execute ./a.out, it hangs and dont give any output. Can you please tell me, what is missing here? Thanks On Tue, 2005-02-22 at 22:32, Greg Martin wrote: > You need to tell gcc to use libexpat when it links (e.g. -lexpat). > Usually a good idea to add the link instruction at the end. > gcc elements.c -lexpat > > > -----Original Message----- > > From: expat-discuss-bounces@libexpat.org > > [mailto:expat-discuss-bounces@libexpat.org] On Behalf Of > > Muhammad Rizwan Khan > > Sent: Tuesday, February 22, 2005 7:29 AM > > To: expat-discuss@libexpat.org > > Subject: [Expat-discuss] how to compile > > > > Hello > > > > I have just installed expat on my system. When i tried to > > compile the program given in the example directory provided > > with the distribution, im getting the following error message: > > > > [root@Rizwan examples]# gcc elements.c > > /tmp/cceoXODZ.o(.text+0x80): In function `main': > > : undefined reference to `XML_ParserCreate' > > /tmp/cceoXODZ.o(.text+0xa8): In function `main': > > : undefined reference to `XML_SetUserData' > > /tmp/cceoXODZ.o(.text+0xc3): In function `main': > > : undefined reference to `XML_SetElementHandler' > > /tmp/cceoXODZ.o(.text+0x11c): In function `main': > > : undefined reference to `XML_Parse' > > /tmp/cceoXODZ.o(.text+0x131): In function `main': > > : undefined reference to `XML_GetCurrentLineNumber' > > /tmp/cceoXODZ.o(.text+0x143): In function `main': > > : undefined reference to `XML_GetErrorCode' > > /tmp/cceoXODZ.o(.text+0x14c): In function `main': > > : undefined reference to `XML_ErrorString' > > /tmp/cceoXODZ.o(.text+0x18a): In function `main': > > : undefined reference to `XML_ParserFree' > > collect2: ld returned 1 exit status > > > > Can you please guide me, what i need to do in order to > > compile this program. > > > > Thanks > > > > > > _______________________________________________ > > Expat-discuss mailing list > > Expat-discuss@libexpat.org > > http://mail.libexpat.org/mailman/listinfo/expat-discuss > > From Greg.Martin at TELUS.COM Wed Feb 23 16:39:10 2005 From: Greg.Martin at TELUS.COM (Greg Martin) Date: Wed Feb 23 16:39:13 2005 Subject: [Expat-discuss] how to compile Message-ID: <87E369A7FEF45C4D9980D1E99A74C8BD15C60D@BCMSG110.corp.ads> It's not actually hanging - it's waiting for input. If you read the comment at the top of the file you'll find the program reads from stdin and writes to stdout. In other words it acts like a filter. You'll need to pipe input to it : cat yourfile.xml | ./a.out or after running : ./a.out Type: stuff > -----Original Message----- > From: expat-discuss-bounces@libexpat.org > [mailto:expat-discuss-bounces@libexpat.org] On Behalf Of > Muhammad Rizwan Khan > Sent: Wednesday, February 23, 2005 2:46 AM > To: expat-discuss@libexpat.org > Subject: RE: [Expat-discuss] how to compile > > > Thanks for your help. Program is running but the problem is i > can't run it. Whenever i execute ./a.out, it hangs and dont > give any output. > Can you please tell me, what is missing here? > > Thanks > > On Tue, 2005-02-22 at 22:32, Greg Martin wrote: > > You need to tell gcc to use libexpat when it links (e.g. -lexpat). > > Usually a good idea to add the link instruction at the end. > > gcc elements.c -lexpat > > > > > -----Original Message----- > > > From: expat-discuss-bounces@libexpat.org > > > [mailto:expat-discuss-bounces@libexpat.org] On Behalf Of Muhammad > > > Rizwan Khan > > > Sent: Tuesday, February 22, 2005 7:29 AM > > > To: expat-discuss@libexpat.org > > > Subject: [Expat-discuss] how to compile > > > > > > Hello > > > > > > I have just installed expat on my system. When i tried to compile > > > the program given in the example directory provided with the > > > distribution, im getting the following error message: > > > > > > [root@Rizwan examples]# gcc elements.c > > > /tmp/cceoXODZ.o(.text+0x80): In function `main': > > > : undefined reference to `XML_ParserCreate' > > > /tmp/cceoXODZ.o(.text+0xa8): In function `main': > > > : undefined reference to `XML_SetUserData' > > > /tmp/cceoXODZ.o(.text+0xc3): In function `main': > > > : undefined reference to `XML_SetElementHandler' > > > /tmp/cceoXODZ.o(.text+0x11c): In function `main': > > > : undefined reference to `XML_Parse' > > > /tmp/cceoXODZ.o(.text+0x131): In function `main': > > > : undefined reference to `XML_GetCurrentLineNumber' > > > /tmp/cceoXODZ.o(.text+0x143): In function `main': > > > : undefined reference to `XML_GetErrorCode' > > > /tmp/cceoXODZ.o(.text+0x14c): In function `main': > > > : undefined reference to `XML_ErrorString' > > > /tmp/cceoXODZ.o(.text+0x18a): In function `main': > > > : undefined reference to `XML_ParserFree' > > > collect2: ld returned 1 exit status > > > > > > Can you please guide me, what i need to do in order to > compile this > > > program. > > > > > > Thanks > > > > > > > > > _______________________________________________ > > > Expat-discuss mailing list > > > Expat-discuss@libexpat.org > > > http://mail.libexpat.org/mailman/listinfo/expat-discuss > > > > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss@libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss > From ali at mental.com Wed Feb 23 17:40:30 2005 From: ali at mental.com (Albrecht Fritzsche) Date: Wed Feb 23 18:10:23 2005 Subject: [Expat-discuss] how to compile Message-ID: > Thanks for your help. Program is running but the problem is i can't run > it. Whenever i execute ./a.out, it hangs and dont give any output. > Can you please tell me, what is missing here? Possibly the input? Ali From fahidka at yahoo.com Wed Feb 23 17:51:50 2005 From: fahidka at yahoo.com (fahid kooloth) Date: Wed Feb 23 20:41:17 2005 Subject: [Expat-discuss] libexpat for arm big-endian required Message-ID: <20050223165150.84359.qmail@web54403.mail.yahoo.com> hai, I require an expat library to target arm --> big endian. I will be very thankfull for your suggessions. with regards, Fahid --------------------------------- Do you Yahoo!? Yahoo! Sports - Sign up for Fantasy Baseball. From rizwan at advcomm.net Fri Feb 25 08:51:25 2005 From: rizwan at advcomm.net (Muhammad Rizwan Khan) Date: Fri Feb 25 08:51:42 2005 Subject: [Expat-discuss] help for a program Message-ID: <1109317885.15412.16.camel@Rizwan> Hello I am new to this library and XML. I want to write a program which 'll be given a xml packet (file) it 'll parse the packet and 'll return the values. Input to the program is as follows: stuff stuff1 . . . output should be as: test one inner stuff inner stuff1 .... Can you please guide me how i can do that, speically: inner stuff inner stuff1 ... stuff Thanks From rizwan at advcomm.net Fri Feb 25 10:14:28 2005 From: rizwan at advcomm.net (Muhammad Rizwan Khan) Date: Fri Feb 25 10:14:57 2005 Subject: [Expat-discuss] help for a program In-Reply-To: <1109317885.15412.16.camel@Rizwan> References: <1109317885.15412.16.camel@Rizwan> Message-ID: <1109322868.15412.24.camel@Rizwan> And another question is that, is this library support to generate XML packet. Like if i am sending some data outside to my application through an XML packet in the following format: stuff stuff1 Can you please guide me how can i generate this XML pakcet. Thanks On Fri, 2005-02-25 at 12:51, Muhammad Rizwan Khan wrote: > Hello > > I am new to this library and XML. I want to write a program which 'll be > given a xml packet (file) it 'll parse the packet and 'll return the > values. > Input to the program is as follows: > > > stuff > stuff1 . . . > > output should be as: > test > one > inner stuff > inner stuff1 > .... > > Can you please guide me how i can do that, speically: > inner stuff inner stuff1 ... stuff > > Thanks > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss@libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss From nickmacd at gmail.com Fri Feb 25 15:13:28 2005 From: nickmacd at gmail.com (Nick MacDonald) Date: Fri Feb 25 15:13:31 2005 Subject: [Expat-discuss] help for a program In-Reply-To: <1109317885.15412.16.camel@Rizwan> References: <1109317885.15412.16.camel@Rizwan> Message-ID: Hmmm... Been following the list now for a while, and am noticing a trend... is there no Expat FAQ to point these people to? Anyway... in answer to your question... Start with the example program, and play with it to understand it. Then expand it to do what you want. It is a pretty easy exercise. Expat makes calls back into your code each time it recognizes an "event", such as the start of an XML tag, the contents between two tags, and the end of a tag. Because it works this way, you quite probably need to build a stack (the data structure) to push and pop tags onto so you know the "context" of the file you are in. Good luck... On Fri, 25 Feb 2005 12:51:25 +0500, Muhammad Rizwan Khan wrote: > I am new to this library and XML. I want to write a program which 'll be > given a xml packet (file) it 'll parse the packet and 'll return the > values. > Input to the program is as follows: > > > stuff > stuff1 . . . > > output should be as: > test > one > inner stuff > inner stuff1 > .... > > Can you please guide me how i can do that, speically: > inner stuff inner stuff1 ... stuff From karl at waclawek.net Fri Feb 25 15:18:10 2005 From: karl at waclawek.net (Karl Waclawek) Date: Fri Feb 25 15:18:17 2005 Subject: [Expat-discuss] help for a program In-Reply-To: References: <1109317885.15412.16.camel@Rizwan> Message-ID: <421F33A2.4070405@waclawek.net> Nick MacDonald wrote: > Hmmm... Been following the list now for a while, and am noticing a > trend... is there no Expat FAQ to point these people to? There is the web site, http://www.libexpat.org. It points to a tutorial. There are the demo apps. One should really have a look at these first, then many questions would not even come up. Karl From regis.st-gelais at laubrass.com Fri Feb 25 15:22:55 2005 From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais_=28Laubrass=29?=) Date: Fri Feb 25 15:24:40 2005 Subject: [Expat-discuss] help for a program References: <1109317885.15412.16.camel@Rizwan> Message-ID: <012901c51b45$7fe2a3a0$6400a8c0@laubrasssag1> >And another question is that, is this library support to generate XML >packet. Like if i am sending some data outside to my application through >an XML packet in the following format: > > > stuff > stuff1 > > > >Can you please guide me how can i generate this XML pakcet. > >Thanks Expat is a Parser (it only read XML files) I use fprintf to generate my XML files. From opengeometry at yahoo.ca Fri Feb 25 17:26:22 2005 From: opengeometry at yahoo.ca (William Park) Date: Fri Feb 25 17:26:30 2005 Subject: [Expat-discuss] help for a program In-Reply-To: <1109317885.15412.16.camel@Rizwan> References: <1109317885.15412.16.camel@Rizwan> Message-ID: <20050225162622.GA1974@node1.opengeometry.net> On Fri, Feb 25, 2005 at 12:51:25PM +0500, Muhammad Rizwan Khan wrote: > > Hello > > I am new to this library and XML. I want to write a program which 'll be > given a xml packet (file) it 'll parse the packet and 'll return the > values. > Input to the program is as follows: > > > stuff > stuff1 > . . . > > output should be as: > test > one > inner stuff > inner stuff1 > .... > > Can you please guide me how i can do that, speically: > inner stuff inner stuff1 ... stuff If you want to do this in C, then you actually have to read the doc and examples. (www.libexpat.org). If you want to do this in shell, then use my patch to Bash (http://freshmeat.net/projects/bashdiff/). Play around with start () { # Usage: start tag att=value ... echo echo -n "$1" } data () { # Usage: data data echo -n " $*" } xml -s start -d data '...' If you're interested in data for tags only, then data () { case ${XML_ELEMENT_STACK[1]} in inner) echo -n " $*" ;; esac } -- William Park , Toronto, Canada Slackware Linux -- because I can type. From rizwan at advcomm.net Sat Feb 26 12:15:55 2005 From: rizwan at advcomm.net (Muhammad Rizwan Khan) Date: Sat Feb 26 12:16:24 2005 Subject: [Expat-discuss] help for a program In-Reply-To: <20050225162622.GA1974@node1.opengeometry.net> References: <1109317885.15412.16.camel@Rizwan> <20050225162622.GA1974@node1.opengeometry.net> Message-ID: <1109416555.20856.5.camel@Rizwan> Thanks of all for helping me. I have almost solved all of the isses related to xml parsing, but there is little problem. I am still unable to find function which can return me contents embeded in element. e.g contents of element. I can't access the "contents of element" string. Although i read documentation but still facing this problem. Another thing is that explite documentation is little complex for newbie. If any body know how i can solve this problem, please let me know about. Thanks On Fri, 2005-02-25 at 21:26, William Park wrote: > On Fri, Feb 25, 2005 at 12:51:25PM +0500, Muhammad Rizwan Khan wrote: > > > > Hello > > > > I am new to this library and XML. I want to write a program which 'll be > > given a xml packet (file) it 'll parse the packet and 'll return the > > values. > > Input to the program is as follows: > > > > > > stuff > > stuff1 > > . . . > > > > output should be as: > > test > > one > > inner stuff > > inner stuff1 > > .... > > > > Can you please guide me how i can do that, speically: > > inner stuff inner stuff1 ... stuff > > If you want to do this in C, then you actually have to read the doc and > examples. (www.libexpat.org). > > If you want to do this in shell, then use my patch to Bash > (http://freshmeat.net/projects/bashdiff/). Play around with > > start () { # Usage: start tag att=value ... > echo > echo -n "$1" > } > data () { # Usage: data data > echo -n " $*" > } > xml -s start -d data '...' > > If you're interested in data for tags only, then > > data () { > case ${XML_ELEMENT_STACK[1]} in > inner) echo -n " $*" ;; > esac > } > From mike at mikeware.cz Sat Feb 26 15:25:19 2005 From: mike at mikeware.cz (Mike) Date: Sat Feb 26 15:26:25 2005 Subject: [Expat-discuss] help for a program In-Reply-To: <1109416555.20856.5.camel@Rizwan> Message-ID: <20050226142616.EF08E30874@ns.arachne.cz> > Thanks of all for helping me. > I have almost solved all of the isses related to xml parsing, > but there is little problem. I am still unable to find function which can return > me contents embeded in element. e.g contents of > element. I > can't access the "contents of element" string. Although i read > documentation but still facing this problem. Another thing is that > explite documentation is little complex for newbie. Uhm ... ok then. Basically you need to define atleast three functions: ==== static void start(void *data, const char *el, const char **attr); Handles start element tag, so in your case it's invoked when parser finds . Here you can - for example - let your program know about element evidence, prepare for character data processing, read attributes of this element etc. ==== static void end(void *data, const char *el); Handles start element tag, in this case. You know that there is no more character data for this tag. ==== static void chardata(void *data, const char *value, int len); Does what you asked for. It's invoked for every character data in xml, so you have to control what to do based on start()/end() states. Remember that chardata() is invoked for every character data in xml, so if you have for example Test string bahbah then chardata() is invoked for: - CRLF and two SPC between and and It's reason why you have to control behaviour of chardata() with respect of start() and end() state. BTW in case your character data contains any other encoding which Expat doesn't support (RTFM), you need one more function: int unknownEncoding(void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); to translate character data. Hope it helps. Mike P.S. Hmm, maybe it's not as bad idea to make some newbies faq, it could clean up a littlebit expat-discuss and expat-bugs atleast. Fred, Karl, should i try to write something eventually? From zjobbagy26 at yahoo.co.nz Mon Feb 28 00:09:47 2005 From: zjobbagy26 at yahoo.co.nz (=?ISO-8859-1?Q?Jobb=E1gy_Zsigmond?=) Date: Mon Feb 28 00:08:10 2005 Subject: [Expat-discuss] expat beginner:how to parse longer doc with ParseBuffer Message-ID: <4222533B.5010200@yahoo.co.nz> Hi, I'm rather new to expat, trying to figure out how it works. Here is what I don't understand: When calling XML_Parse(...), or XML_ParseBuffer for longer documents, there is the IsFinal parameter, which tells expat if there is any more of the document. I couldn't find anything in the documentation about whether the pieces should end and start so, that they remain "well-formed" (is it possible at all?). When I feed in the document with a certain bufsize, I get an error message right after the start of parsing the second piece. Here is a test output showing what's in the buffer along the calls: buffer starts as: SZNY 742 buffer ends as: > buffered: 1000 Parse error at line 198: not well-formed (invalid token) In this example, I show, that the last closing element was truncated when buffered, but it was listed before the second buffering... Can I expect expat to treat this (and so I made something wrong somewhere else), or some other trick is needed to avoid this behaviour? My document is well-formed (as I checked with Firefox). I guess there must be a very simple solution for this, or I just thought expat would be easy and it isn't... The code is what I found in elements.c + some of mine. Thanks Zsigmond From karl at waclawek.net Mon Feb 28 01:07:34 2005 From: karl at waclawek.net (Karl Waclawek) Date: Mon Feb 28 01:07:36 2005 Subject: [Expat-discuss] expat beginner:how to parse longer doc with ParseBuffer In-Reply-To: <4222533B.5010200@yahoo.co.nz> References: <4222533B.5010200@yahoo.co.nz> Message-ID: <422260C6.9050109@waclawek.net> Jobb?gy Zsigmond wrote: > Hi, > > I'm rather new to expat, trying to figure out how it works. Here is what > I don't understand: > When calling XML_Parse(...), or XML_ParseBuffer for longer documents, > there is the IsFinal parameter, which tells > expat if there is any more of the document. I couldn't find anything in > the documentation about whether the > pieces should end and start so, that they remain "well-formed" (is it > possible at all?). Buffer boundaries can be anywhere, even in the middle of markup. Expat will see the "big picture" correctly. Your examples are not detailed enough to know what is going wrong. Btw, Firefox uses Expat. Karl From zjobbagy26 at yahoo.co.nz Mon Feb 28 12:22:24 2005 From: zjobbagy26 at yahoo.co.nz (=?iso-8859-1?q?Zsigmond=20Jobb=E1gy?=) Date: Mon Feb 28 12:22:28 2005 Subject: [Expat-discuss] Re: Expat-discuss Digest, Vol 59, Issue 14 In-Reply-To: <20050228110106.674C91E401E@bag.python.org> Message-ID: <20050228112224.98779.qmail@web41523.mail.yahoo.com> Thanks for this, Karl. At least I know that it should work as I expected. Regards > Jobb?gy Zsigmond wrote: > > Hi, > > > > I'm rather new to expat, trying to figure out how > it works. Here is what > > I don't understand: > > When calling XML_Parse(...), or XML_ParseBuffer > for longer documents, > > there is the IsFinal parameter, which tells > > expat if there is any more of the document. I > couldn't find anything in > > the documentation about whether the > > pieces should end and start so, that they remain > "well-formed" (is it > > possible at all?). > > Buffer boundaries can be anywhere, even in the > middle of markup. > Expat will see the "big picture" correctly. > > Your examples are not detailed enough to know what > is going wrong. > Btw, Firefox uses Expat. > > Karl > > > ------------------------------ > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss@libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss > > > End of Expat-discuss Digest, Vol 59, Issue 14 > ********************************************* > Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com