From karl at waclawek.net Mon Nov 3 11:41:05 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Mon Nov 3 11:41:19 2003
Subject: [Expat-discuss] Suspend/resume and abort patch available
Message-ID: <000e01c3a229$471456e0$9e539696@citkwaclaww2k>
A new patch for Expat is available that adds
suspend/resume and abort functionality to Expat.
Check out patch #835123: Suspend/Resume functionality,
http://sourceforge.net/tracker/index.php?func=detail&aid=835123&group_id=10127&atid=310127.
This should give a clean way to abort parsing or suspend and resume later.
The API has been updated as follows:
- Added XML_STATUS_SUSPENDED to enum XML_Status
- Added function XML_StopParser()
- Added function XML_ResumeParser()
- Added more error codes and strings
Usage is simple: from within a handler call-back call
XML_StopParser(parser, resumable);
If resumable is true, XML_Parse(Buffer) returns
with XML_STATUS_SUSPENDED, otherwise it returns
with XML_STATUS_ERROR and the error code is XML_ERROR_ABORTED.
You can resume parsing simply by calling XML_Resume(parser),
which will return the same status and error codes as XML_Parser(Buffer).
This API is subject to change, especially if this patch doesn't make
it into release 2.0, as an API overhaul is planned for release 3.0.
It seems to be working well for me, passes all XML_Test_Suite tests,
but I would really like it to be subjected to some heavy duty testing.
Karl
From hmcc at cs.york.ac.uk Fri Nov 7 05:29:35 2003
From: hmcc at cs.york.ac.uk (Heather McCartney)
Date: Fri Nov 7 05:32:38 2003
Subject: [Expat-discuss] empty tags
Message-ID: <4.3.2.7.0.20031107102824.00b36328@imap.cs.york.ac.uk>
I know there was a discussion of this some time ago, but I would like to
check something.
When the parser comes across a tag like , which function gets
called? Is treated as a start tag, an end tag, both a start and end
tag, or character data?
Thanks,
Heather
From carlos at pehoe.civil.ist.utl.pt Fri Nov 7 06:38:21 2003
From: carlos at pehoe.civil.ist.utl.pt (Carlos Pereira)
Date: Fri Nov 7 06:30:09 2003
Subject: [Expat-discuss] Re: empty tags
Message-ID: <20031107113821.A2F32905@pehoe.civil.ist.utl.pt>
>I know there was a discussion of this some time ago, but I would like to
>check something.
>When the parser comes across a tag like , which function gets
>called? Is treated as a start tag, an end tag, both a start and end
>tag, or character data?
This case is treated EXACTLY as if you had ,
so the start_element function is called first, then the
end_element is called. In fact your code doesn't even
know whether the data came from or .
This is somewhere in the manual ;-)
Carlos
From hmcc at cs.york.ac.uk Mon Nov 10 10:20:05 2003
From: hmcc at cs.york.ac.uk (Heather McCartney)
Date: Mon Nov 10 10:22:49 2003
Subject: [Expat-discuss] input to example programs
Message-ID: <4.3.2.7.0.20031110151800.00b25b08@imap.cs.york.ac.uk>
Thanks Carlos for your help in understanding the treatment of empty tags.
I'm now trying to run the example program outline.c (on Windows 2000 using
the Borland compiler). The program compiles and runs fine, but I was
wondering how I tell it what to parse. The program reads from stdin.
However, while the program is running, any characters I type in are simply
ignored. Is this something to do with the encoding, or is the program
expecting an input from somewhere else? If the manual explains how to set
the encoding, I must have missed it. I know I can use US-ASCII, UTF-8 etc,
but simply passing these values to XML_ParserCreate (e.g.
XML_ParserCreate(UTF-8)) results in a compilation error, as UTF-8 is an
unknown symbol.
I've also tried changing the program to read from a (UTF-8 or ASCII) text
file, without success. The file is not copied to the buffer, even using
strcpy rather than the Expat functions. However, it is copied to another
character array r.
Does anybody know how to deal with this? I know this must seem very basic
to some of you, but I would really appreciate some help.
Thanks,
Heather
outline.c is as follows:
>/*****************************************************************
> * outline.c
> *
> * Copyright 1999, Clark Cooper
> * All rights reserved.
> *
> * This program is free software; you can redistribute it and/or
> * modify it under the terms of the license contained in the
> * COPYING file that comes with the expat distribution.
> *
> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> *
> * Read an XML document from standard input and print an element
> * outline on standard output.
> */
>
>
>#include
>#include
>
>#define BUFFSIZE 8192
>
>char Buff[BUFFSIZE];
>
>int Depth;
>
>static void XMLCALL
>start(void *data, const char *el, const char **attr)
>{
> int i;
>
> for (i = 0; i < Depth; i++)
> printf(" ");
>
> printf("%s", el);
>
> for (i = 0; attr[i]; i += 2) {
> printf(" %s='%s'", attr[i], attr[i + 1]);
> }
>
> printf("\n");
> Depth++;
>}
>
>static void XMLCALL
>end(void *data, const char *el)
>{
> Depth--;
>}
>
>int
>main(int argc, char *argv[])
>{
> XML_Parser p = XML_ParserCreate(NULL);
> if (! p) {
> fprintf(stderr, "Couldn't allocate memory for parser\n");
> exit(-1);
> }
>
> XML_SetElementHandler(p, start, end);
>
> 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(p, Buff, len, done) == XML_STATUS_ERROR) {
> fprintf(stderr, "Parse error at line %d:\n%s\n",
> XML_GetCurrentLineNumber(p),
> XML_ErrorString(XML_GetErrorCode(p)));
> exit(-1);
> }
>
> if (done)
> break;
> }
> return 0;
>}
>
>I tried changing it as follows:
>
>/*****************************************************************
> * test.c
> *
> *
> * Read an XML document from a file and print an element
> * outline on standard output.
> */
>
>
>#include
>#include <_str.h>
>#include
>
>#define BUFFSIZE 8192
>
>char Buff[BUFFSIZE];
>
>int Depth;
>
>static void XMLCALL
>start(void *data, const char *el, const char **attr)
>{
> int i;
>
> for (i = 0; i < Depth; i++)
> printf(" ");
>
> printf("%s", el);
>
> for (i = 0; attr[i]; i += 2) {
> printf(" %s='%s'", attr[i], attr[i + 1]);
> }
>
> printf("\n");
> Depth++;
>}
>
>static void XMLCALL
>end(void *data, const char *el)
>{
> Depth--;
>}
>
>int
>main(int argc, char *argv[])
>{
>
>FILE *f;
>char s[127], r[127];
>
> XML_Parser p = XML_ParserCreate(NULL);
> if (! p) {
> fprintf(stderr, "Couldn't allocate memory for parser\n");
> exit(-1);
> }
>
> f=fopen("sum.txt","r");
> if (!f)
> return 1;
>
> fread(r,sizeof(r),1,f);
> printf("%s\n",r);
>
>XML_SetElementHandler(p, start, end);
>
> for (;;) {
> int done;
> int len;
>
> len = fread(Buff, BUFFSIZE, 1, f);
> if (ferror(f))
> {
> fprintf(stderr, "Read error\n");
> fclose(f);
> exit(-1);
> }
>
> printf("%s\n",Buff);
> printf("Buff = %d\n", Buff);
> printf("contents of Buff = %s\n", Buff);
> printf("BUFFSIZE = %d\n", BUFFSIZE);
> printf("len = %d\n", len);
>
> done = feof(f);
> printf("done = %d\n", done);
>
> strcpy(Buff, r);
> printf("%s\n",Buff);
> printf("Buff = %d\n", Buff);
> printf("contents of Buff = %s\n", Buff);
> printf("BUFFSIZE = %d\n", BUFFSIZE);
> printf("len = %d\n", len);
>
> done = feof(f);
> printf("done = %d\n", done);
>
> if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR)
> {
> fprintf(stderr, "Parse error at line %d:\n%s\n",
> XML_GetCurrentLineNumber(p),
> XML_ErrorString(XML_GetErrorCode(p)));
> fclose(f);
> exit(-1);
> }
>
> if (done)
> break;
> }
> fclose(f);
> return 0;
>}
>
>--=====================_20936703==_.ALT
>Content-Type: text/html; charset="us-ascii"
>
>
>Thanks Carlos for your help in understanding the treatment of empty tags.
>
>I'm now trying to run the example program outline.c (on Windows 2000 using
>the Borland compiler). The program compiles and runs fine, but I was
>wondering how I tell it what to parse. The program reads from stdin.
>However, while the program is running, any characters I type in are simply
>ignored. Is this something to do with the encoding, or is the program
>expecting an input from somewhere else? If the manual explains how to set
>the encoding, I must have missed it. I know I can use US-ASCII, UTF-8 etc,
>but simply passing these values to XML_ParserCreate (e.g.
>XML_ParserCreate(UTF-8)) results in a compilation error, as UTF-8 is an
>unknown symbol.
>
>I've also tried changing the program to read from a (UTF-8 or ASCII) text
>file, without success. The file is not copied to the buffer, even using
>strcpy rather than the Expat functions. However, it is copied to another
>variable r.
>
>Does anybody know how to deal with this? I know this must seem very basic
>to some of you, but I would really appreciate some help.
>
>Thanks,
>Heather
>
>
>
>outline.c is as follows:
>
>/*****************************************************************
> * outline.c
> *
> * Copyright 1999, Clark Cooper
> * All rights reserved.
> *
> * This program is free software; you can redistribute it and/or
> * modify it under the terms of the license contained in the
> * COPYING file that comes with the expat distribution.
> *
> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> *
> * Read an XML document from standard input and print an element
> * outline on standard output.
> */
>
>
>#include
>#include
>
>#define BUFFSIZE 8192
>
>char Buff[BUFFSIZE];
>
>int Depth;
>
>static void XMLCALL
>start(void *data, const char *el, const char **attr)
>{
> int i;
>
> for (i = 0; i < Depth; i++)
> printf(" ");
>
> printf("%s", el);
>
> for (i = 0; attr[i]; i += 2) {
> printf(" %s='%s'", attr[i], attr[i + 1]);
> }
>
> printf("\n");
> Depth++;
>}
>
>static void XMLCALL
>end(void *data, const char *el)
>{
> Depth--;
>}
>
>int
>main(int argc, char *argv[])
>{
> XML_Parser p = XML_ParserCreate(NULL);
> if (! p) {
> fprintf(stderr, "Couldn't allocate memory for parser\n");
> exit(-1);
> }
>
> XML_SetElementHandler(p, start, end);
>
> 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(p, Buff, len, done) == XML_STATUS_ERROR) {
> fprintf(stderr, "Parse error at line %d:\n%s\n",
> XML_GetCurrentLineNumber(p),
> XML_ErrorString(XML_GetErrorCode(p)));
> exit(-1);
> }
>
> if (done)
> break;
> }
> return 0;
>}
>
>I tried changing it as follows:
>
>/*****************************************************************
> * test.c
> *
> *
> * Read an XML document from a file and print an element
> * outline on standard output.
> */
>
>
>#include
>#include <_str.h>
>#include
>
>#define BUFFSIZE 8192
>
>char Buff[BUFFSIZE];
>
>int Depth;
>
>static void XMLCALL
>start(void *data, const char *el, const char **attr)
>{
> int i;
>
> for (i = 0; i < Depth; i++)
> printf(" ");
>
> printf("%s", el);
>
> for (i = 0; attr[i]; i += 2) {
> printf(" %s='%s'", attr[i], attr[i + 1]);
> }
>
> printf("\n");
> Depth++;
>}
>
>static void XMLCALL
>end(void *data, const char *el)
>{
> Depth--;
>}
>
>int
>main(int argc, char *argv[])
>{
>
>FILE *f;
>char s[127], r[127];
>
> XML_Parser p = XML_ParserCreate(NULL);
> if (! p) {
> fprintf(stderr, "Couldn't allocate memory for parser\n");
> exit(-1);
> }
>
> f=fopen("sum.txt","r");
> if (!f)
> return 1;
>
> fread(r,sizeof(r),1,f);
> printf("%s\n",r);
>
>XML_SetElementHandler(p, start, end);
>
> for (;;) {
> int done;
> int len;
>
> len = fread(Buff, BUFFSIZE, 1, f);
> if (ferror(f))
> {
> fprintf(stderr, "Read error\n");
> fclose(f);
> exit(-1);
> }
>
> printf("%s\n",Buff);
> printf("Buff = %d\n", Buff);
> printf("contents of Buff = %s\n", Buff);
> printf("BUFFSIZE = %d\n", BUFFSIZE);
> printf("len = %d\n", len);
>
> done = feof(f);
> printf("done = %d\n", done);
>
> strcpy(Buff, r);
> printf("%s\n",Buff);
> printf("Buff = %d\n", Buff);
> printf("contents of Buff = %s\n", Buff);
> printf("BUFFSIZE = %d\n", BUFFSIZE);
> printf("len = %d\n", len);
>
> done = feof(f);
> printf("done = %d\n", done);
>
> if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR)
> {
> fprintf(stderr, "Parse error at line %d:\n%s\n",
> XML_GetCurrentLineNumber(p),
> XML_ErrorString(XML_GetErrorCode(p)));
> fclose(f);
> exit(-1);
> }
>
> if (done)
> break;
> }
> fclose(f);
> return 0;
>}
From jgarbers at xltsoftware.com Mon Nov 10 11:13:37 2003
From: jgarbers at xltsoftware.com (Jeff Garbers)
Date: Mon Nov 10 11:14:17 2003
Subject: [Expat-discuss] Split UTF-8 sequence possible?
Message-ID:
Having just overcome the newbie problem of not realizing that expat
feeds UTF-8 sequences to my handlers, I'm now wondering if
expat ever splits a multi-byte UTF-8 sequence across two calls to my
character handler callback.
For example, say there's a non-ASCII accented character
in its input character data (however it may have been encoded).
expat will want to send me a two-byte UTF-8 sequence. If there's
only one byte left in the output buffer, will it (1) call my character
data
callback with the buffer one short of capacity, and save the two-byte
sequence for the next callback, or (2) put the first of the two UTF-8
bytes in the buffer, call my callback, and then put the second at the
start of the buffer for the NEXT callback?
I'm really hoping #1. Can anybody confirm this?
Thanks -- Jeff Garbers
From karl at waclawek.net Mon Nov 10 11:38:45 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Mon Nov 10 11:38:53 2003
Subject: [Expat-discuss] Split UTF-8 sequence possible?
References:
Message-ID: <005601c3a7a9$1c2cde40$9e539696@citkwaclaww2k>
> Having just overcome the newbie problem of not realizing that expat
> feeds UTF-8 sequences to my handlers, I'm now wondering if
> expat ever splits a multi-byte UTF-8 sequence across two calls to my
> character handler callback.
>
> For example, say there's a non-ASCII accented character
> in its input character data (however it may have been encoded).
> expat will want to send me a two-byte UTF-8 sequence. If there's
> only one byte left in the output buffer, will it (1) call my character
> data
> callback with the buffer one short of capacity, and save the two-byte
> sequence for the next callback, or (2) put the first of the two UTF-8
> bytes in the buffer, call my callback, and then put the second at the
> start of the buffer for the NEXT callback?
>
> I'm really hoping #1. Can anybody confirm this?
I am pretty sure Expat reports complete characters, as nothing
else makes sense. There are no output buffer boundaries forced on Expat.
Karl
From karl at waclawek.net Mon Nov 10 14:39:12 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Mon Nov 10 14:39:23 2003
Subject: [Expat-discuss] input to example programs
References: <4.3.2.7.0.20031110151800.00b25b08@imap.cs.york.ac.uk>
Message-ID: <001a01c3a7c2$51902100$9e539696@citkwaclaww2k>
> I'm now trying to run the example program outline.c (on Windows 2000 using
> the Borland compiler). The program compiles and runs fine, but I was
> wondering how I tell it what to parse. The program reads from stdin.
> However, while the program is running, any characters I type in are simply
> ignored.
Try running it by redirecting a file to standard input:
outline.exe
Hi,
I'm looking for a small, fast, well-formdness-only-checking, xml parser
that runs in the linux kernel space. Can I use expat for that. If not, is
there any other suitable for this task?
--
Gregor Zeitlinger
gregor@zeitlinger.de
From karl at waclawek.net Thu Nov 13 08:57:22 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Thu Nov 13 08:57:35 2003
Subject: [Expat-discuss] running expat in kernel space
References:
Message-ID: <000d01c3a9ee$0fdfed70$9e539696@citkwaclaww2k>
> Hi,
>
> I'm looking for a small, fast, well-formdness-only-checking, xml parser
> that runs in the linux kernel space. Can I use expat for that. If not, is
> there any other suitable for this task?
I know almost nothing about what it takes to run in kernel space.
If you enlighten me, maybe I can tell you if Expat fulfills
your requirements.
If its just about memory handling - Expat allows you
to plug in your own memory management.
Karl
From zeitling at informatik.hu-berlin.de Thu Nov 13 09:04:30 2003
From: zeitling at informatik.hu-berlin.de (Gregor Zeitlinger)
Date: Thu Nov 13 09:04:35 2003
Subject: [Expat-discuss] running expat in kernel space
In-Reply-To: <000d01c3a9ee$0fdfed70$9e539696@citkwaclaww2k>
Message-ID:
On Thu, 13 Nov 2003, Karl Waclawek wrote:
> If its just about memory handling - Expat allows you
> to plug in your own memory management.
I think it is. But it would be even better to use no memory other than the
stack at all.
I only need SAX functionality.
--
Gregor Zeitlinger
gregor@zeitlinger.de
From karl at waclawek.net Thu Nov 13 09:28:31 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Thu Nov 13 09:28:43 2003
Subject: [Expat-discuss] running expat in kernel space
References:
Message-ID: <004801c3a9f2$69e6f7b0$9e539696@citkwaclaww2k>
> On Thu, 13 Nov 2003, Karl Waclawek wrote:
> > If its just about memory handling - Expat allows you
> > to plug in your own memory management.
> I think it is. But it would be even better to use no memory other than the
> stack at all.
> I only need SAX functionality.
Does Linux (I assume that is your OS) support the alloca() function?
In that case you could pre-allocate a chunk of memory on the stack
(in the function that creates and frees the parser instance),
and let your custom memory handler call-backs allocate from this
buffer. Expat tries to re-use memory internally and does not
call back on the memory manager that often.
Karl
From maskofzero at hotmail.com Thu Nov 13 21:34:09 2003
From: maskofzero at hotmail.com (zero Z)
Date: Thu Nov 13 21:34:13 2003
Subject: [Expat-discuss] Questions on expat/win32 parser
Message-ID:
1. The example pointed to on the web page is from 99, and the
documentation
only mentions DTD related functions. where are the schema related api's
????!!
2. Also same problem with the windows nt lib.
3. Can i find an example app that exercises all the api's, even if
trivially? this is driving me crazy!
thanks!!!
_________________________________________________________________
Is your computer infected with a virus? Find out with a FREE computer virus
scan from McAfee. Take the FreeScan now!
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
From fdrake at acm.org Thu Nov 13 21:36:24 2003
From: fdrake at acm.org (Fred L. Drake, Jr.)
Date: Thu Nov 13 21:36:45 2003
Subject: [Expat-discuss] Re: Expat examples, outdated links etc
In-Reply-To: <40F7CC930268AF42A8EB25966623CEAA05BBE06A@mail-sc-2.nvidia.com>
References: <40F7CC930268AF42A8EB25966623CEAA05BBE06A@mail-sc-2.nvidia.com>
Message-ID: <16308.16296.829203.325030@grendel.zope.com>
Vijay Ganapati writes:
> i saw documentation there is support for schema now, but could not find
> it in the docs or in the libs?
I don't know what documentation you were looking at, but I don't think
it was anything I wrote, or that gets packaged with Expat. Expat can
provide some information from the DTD.
> And is there not an example exercising all the api's exported, even if
> trivially?
There are several examples included with Expat; the xmlwf application
is perhaps the most thorough. If you have additional questions, feel
free to ask here; you may need to be more specific in order to get
useful help.
-Fred
--
Fred L. Drake, Jr.
PythonLabs at Zope Corporation
From regis.st-gelais at laubrass.com Fri Nov 14 10:46:39 2003
From: regis.st-gelais at laubrass.com (=?Windows-1252?Q?R=E9gis_St-Gelais?=)
Date: Fri Nov 14 10:48:08 2003
Subject: [Expat-discuss] Read XML like file
Message-ID: <00c601c3aac6$7e46edd0$647ba8c0@regis>
I would like to use expat to read an XML file that does not have a root
element.
This file contains records, for example it could be some ting like that:
10:40:00some data
10:40:23some other data
10:40:35some other data to
...
10:45:12some data
That way, records can be appened to the file without having to read it
completely and rewrite with the new records
Is this possible, even if it is not fully xml compliant?
TIA
--
R?gis St-Gelais
From graham-expat at simulcra.org Fri Nov 14 16:07:51 2003
From: graham-expat at simulcra.org (Graham Bennett)
Date: Fri Nov 14 16:07:57 2003
Subject: [Expat-discuss] gcc warnings on ia64
Message-ID: <20031114210751.GA26460@lamity.org>
Hi all,
With expat 1.95.7 on ia64, the new XMLCALL macro causes lots of complaints from
gcc. The 'cdecl' attribute is not supported on that platform.
cheers,
Graham.
--
Graham Bennett
From rluyao at info.com.ph Tue Nov 18 00:21:34 2003
From: rluyao at info.com.ph (Ryan Luyao)
Date: Tue Nov 18 00:20:02 2003
Subject: [Expat-discuss] Result of outline.c from the win32 expat binary
Message-ID: <3FB9AC5E.60800@info.com.ph>
Good Day!
This is my first time to develop applications using expat.
I have successfully build the win32 expat binary with Visual
Studio and of course compile and run my expat applications.
As a first timer i have successfully compile elements.c and
outline.c in the examples directory. I just want to confirm if
this is the correct output that i am getting out from outline.c
My sample.xml file looks like this:
65
20
300
2400
300
25
50
Avocado Dip
Sunnydale
29
11
3
5
210
2
0
1
0
0
0
0
i execute outline.c with this syntax:
outline.exe < sample.xml
and got this output:
n
d
t u='g'
s u='g'
c u='m'
s u='m'
c u='g'
f u='g'
p u='g'
f
n
m
s u='g'
c t='1' f='1'
t
s
c
s
c
f
p
v
a
c
m
c
f
I was expecting the complete tag label instead of just the first letter.
Is there any way to print the whole tag label?
By the way, any suggestions and some sample code that you can provide on
how to get the data between the tags; - justanitem
, storing
justanitem to a variable.
I really really appreciate inputs on this. Thanks in advance!
From regis.st-gelais at laubrass.com Tue Nov 18 07:33:09 2003
From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=)
Date: Tue Nov 18 07:33:22 2003
Subject: Fw: [Expat-discuss] Read XML like file
Message-ID: <001501c3add0$2015ac80$647ba8c0@regis>
Here is a reply I got from Tim Fornoville in private e-mail, I am making it public. I guess he forgot to add the expat list in the send to.
From: tim fornoville
To: R?gis_St-Gelais
Sent: Monday, November 17, 2003 3:28 PM
Subject: Re: [Expat-discuss] Read XML like file
R?gis_St-Gelais schrieb am 14.11.03 16:49:53:
>
> I would like to use expat to read an XML file that does not have a root
> element.
does an xml-file "always" need a root?
> This file contains records, for example it could be some ting like that:
>
> 10:40:00some data
> 10:40:23some other data
> 10:40:35some other data to
> ...
> 10:45:12some data
>
>
> That way, records can be appened to the file without having to read it
> completely and rewrite with the new records
>
> Is this possible, even if it is not fully xml compliant?
I see now reason why it wouldn`t work...
tim
>
> TIA
> --
> R?gis St-Gelais
>
>
>
>
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss@libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
______________________________________________________________________________
Horoskop, Comics, VIPs, Wetter, Sport und Lotto im WEB.DE Screensaver1.2
Kostenlos downloaden: http://screensaver.web.de/?mc=021110
From karl at waclawek.net Tue Nov 18 08:59:10 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Tue Nov 18 08:59:23 2003
Subject: [Expat-discuss] Read XML like file
References: <001501c3add0$2015ac80$647ba8c0@regis>
Message-ID: <001301c3addc$2459ef70$9e539696@citkwaclaww2k>
>
> does an xml-file "always" need a root?
Yes.
Karl
From karl at waclawek.net Tue Nov 18 09:05:26 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Tue Nov 18 09:05:45 2003
Subject: [Expat-discuss] Result of outline.c from the win32 expat binary
References: <3FB9AC5E.60800@info.com.ph>
Message-ID: <001901c3addd$04419390$9e539696@citkwaclaww2k>
> This is my first time to develop applications using expat.
> I have successfully build the win32 expat binary with Visual
> Studio and of course compile and run my expat applications.
> As a first timer i have successfully compile elements.c and
> outline.c in the examples directory. I just want to confirm if
> this is the correct output that i am getting out from outline.c
>
> My sample.xml file looks like this:
The output is wrong.
> I was expecting the complete tag label instead of just the first letter.
> Is there any way to print the whole tag label?
What Dll are you using? libexpat.dll or libexpatw.dll?
As far as I can tell, outline.c only works with the UTF-8 version of Expat.
> By the way, any suggestions and some sample code that you can provide on
> how to get the data between the tags; - justanitem
, storing
> justanitem to a variable.
Accumulate data from character handler call-backs in a buffer and
store the buffer contents in a variable when another call-back (other
than to a character data handler) occurs. Then clear the buffer and repeat.
Karl
From regis.st-gelais at laubrass.com Tue Nov 18 09:07:42 2003
From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=)
Date: Tue Nov 18 09:08:57 2003
Subject: [Expat-discuss] Read XML like file
References: <001501c3add0$2015ac80$647ba8c0@regis>
<001301c3addc$2459ef70$9e539696@citkwaclaww2k>
Message-ID: <00cd01c3addd$5535c230$647ba8c0@regis>
----- Original Message -----
From: Karl Waclawek
To: R?gis St-Gelais ; expat-discuss@libexpat.org
Sent: Tuesday, November 18, 2003 8:59 AM
Subject: Re: [Expat-discuss] Read XML like file
>>
>> does an xml-file "always" need a root?
>Yes.
Is there no way to tell expat to parse a file that have multiple roots?
Like that:
10:40:00some data
10:40:23some other data
10:40:35some other data to
Regis
From Greg.Martin at TELUS.COM Tue Nov 18 09:24:57 2003
From: Greg.Martin at TELUS.COM (Greg Martin)
Date: Tue Nov 18 09:25:15 2003
Subject: [Expat-discuss] Read XML like file
Message-ID:
I think the problem is that a valid XML file only has one root (by definition). Why not append a root tag to the beginning and end before parsing?
-----Original Message-----
From: R?gis St-Gelais [mailto:regis.st-gelais@laubrass.com]
Sent: Tuesday, November 18, 2003 7:08 AM
To: Karl Waclawek; expat-discuss@libexpat.org
Subject: Re: [Expat-discuss] Read XML like file
----- Original Message -----
From: Karl Waclawek
To: R?gis St-Gelais ; expat-discuss@libexpat.org
Sent: Tuesday, November 18, 2003 8:59 AM
Subject: Re: [Expat-discuss] Read XML like file
>>
>> does an xml-file "always" need a root?
>Yes.
Is there no way to tell expat to parse a file that have multiple roots?
Like that:
10:40:00some data
10:40:23some other data
10:40:35some other data to
Regis
_______________________________________________
Expat-discuss mailing list
Expat-discuss@libexpat.org
http://mail.libexpat.org/mailman/listinfo/expat-discuss
From mirod at xmltwig.com Tue Nov 18 09:25:47 2003
From: mirod at xmltwig.com (Michel Rodriguez)
Date: Tue Nov 18 09:25:53 2003
Subject: [Expat-discuss] Read XML like file
In-Reply-To: <00cd01c3addd$5535c230$647ba8c0@regis>
Message-ID:
On Tue, 18 Nov 2003, [iso-8859-1] Régis St-Gelais wrote:
> Is there no way to tell expat to parse a file that have multiple roots?
>
> Like that:
> 10:40:00some data
> 10:40:23some other data
> 10:40:35some other data to
You can wrap your actual file in a wrapper that will provide the root
element:
]>
&data;
log.data is:
blahblahblah
blahblahblah
weebleblahblah
--
Michel Rodriguez
Perl & XML
http://www.xmltwig.com
From regis.st-gelais at laubrass.com Tue Nov 18 09:40:31 2003
From: regis.st-gelais at laubrass.com (=?utf-8?Q?R=C3=A9gis_St-Gelais?=)
Date: Tue Nov 18 09:41:10 2003
Subject: [Expat-discuss] Read XML like file
References:
Message-ID: <00f501c3ade1$eb2170b0$647ba8c0@regis>
----- Original Message -----
From: Michel Rodriguez
To: Regis St-Gelais
Cc: expat-discuss@libexpat.org
Sent: Tuesday, November 18, 2003 9:25 AM
Subject: Re: [Expat-discuss] Read XML like file
>You can wrap your actual file in a wrapper that will provide the root
element:
Great idea!
I just have to fill the input buffer with my start root tag and parse it.
Then read my file.
Then fill then input buffer with my end root tag and parse it.
Thanks
Regis
From karl at waclawek.net Tue Nov 18 10:06:28 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Tue Nov 18 10:25:02 2003
Subject: [Expat-discuss] Read XML like file
References:
<00f501c3ade1$eb2170b0$647ba8c0@regis>
Message-ID: <000401c3ade8$1d229750$9e539696@citkwaclaww2k>
> I just have to fill the input buffer with my start root tag and parse it.
> Then read my file.
> Then fill then input buffer with my end root tag and parse it.
Just make sure you use he same character encoding as the document.
Karl
From rluyao at info.com.ph Tue Nov 18 18:14:57 2003
From: rluyao at info.com.ph (Ryan Luyao)
Date: Tue Nov 18 18:13:23 2003
Subject: [Expat-discuss] Result of outline.c from the win32 expat binary
In-Reply-To: <001901c3addd$04419390$9e539696@citkwaclaww2k>
References: <3FB9AC5E.60800@info.com.ph>
<001901c3addd$04419390$9e539696@citkwaclaww2k>
Message-ID: <3FBAA7F1.5080806@info.com.ph>
I was using the libexpatw.dll
Karl Waclawek wrote:
>>This is my first time to develop applications using expat.
>>I have successfully build the win32 expat binary with Visual
>>Studio and of course compile and run my expat applications.
>>As a first timer i have successfully compile elements.c and
>>outline.c in the examples directory. I just want to confirm if
>>this is the correct output that i am getting out from outline.c
>>
>>My sample.xml file looks like this:
>
>
>
>
> The output is wrong.
>
>
>>I was expecting the complete tag label instead of just the first letter.
>>Is there any way to print the whole tag label?
>
>
> What Dll are you using? libexpat.dll or libexpatw.dll?
> As far as I can tell, outline.c only works with the UTF-8 version of Expat.
>
>
>>By the way, any suggestions and some sample code that you can provide on
>>how to get the data between the tags; - justanitem
, storing
>>justanitem to a variable.
>
>
> Accumulate data from character handler call-backs in a buffer and
> store the buffer contents in a variable when another call-back (other
> than to a character data handler) occurs. Then clear the buffer and repeat.
>
> Karl
>
>
From karl at waclawek.net Tue Nov 18 20:07:13 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Tue Nov 18 20:04:31 2003
Subject: [Expat-discuss] Result of outline.c from the win32 expat binary
References: <3FB9AC5E.60800@info.com.ph><001901c3addd$04419390$9e539696@citkwaclaww2k>
<3FBAA7F1.5080806@info.com.ph>
Message-ID: <000701c3ae39$776766e0$0207a8c0@karl>
> I was using the libexpatw.dll
Try libexpat.dll.
Karl
From rluyao at info.com.ph Tue Nov 18 20:13:17 2003
From: rluyao at info.com.ph (Ryan Luyao)
Date: Tue Nov 18 20:11:41 2003
Subject: [Expat-discuss] Result of outline.c from the win32 expat binary
In-Reply-To: <000701c3ae39$776766e0$0207a8c0@karl>
References: <3FB9AC5E.60800@info.com.ph>
<001901c3addd$04419390$9e539696@citkwaclaww2k>
<3FBAA7F1.5080806@info.com.ph>
<000701c3ae39$776766e0$0207a8c0@karl>
Message-ID: <3FBAC3AD.7010306@info.com.ph>
Bravo! Thanks Karl! It work out fine
output:
nutrition
daily-values
total-fat units='g'
saturated-fat units='g'
cholesterol units='mg'
sodium units='mg'
carb units='g'
fiber units='g'
protein units='g'
food
name
mfr
serving units='g'
calories total='110' fat='100'
total-fat
saturated-fat
cholesterol
sodium
carb
fiber
protein
vitamins
a
c
minerals
ca
fe
Karl Waclawek wrote:
>>I was using the libexpatw.dll
>
>
> Try libexpat.dll.
>
> Karl
>
From damitha at opensource.lk Wed Nov 19 00:14:27 2003
From: damitha at opensource.lk (damitha@opensource.lk)
Date: Wed Nov 19 00:14:31 2003
Subject: [Expat-discuss] Is expat thread safe?
Message-ID: <37945.220.247.251.12.1069218867.squirrel@webmail.pair.com>
Hi,
Hi, Is expat thread safe?
thanks in advance
damitha
From fdrake at acm.org Wed Nov 19 12:43:40 2003
From: fdrake at acm.org (Fred L. Drake, Jr.)
Date: Wed Nov 19 12:44:10 2003
Subject: [Expat-discuss] Is expat thread safe?
In-Reply-To: <37945.220.247.251.12.1069218867.squirrel@webmail.pair.com>
References: <37945.220.247.251.12.1069218867.squirrel@webmail.pair.com>
Message-ID: <16315.43980.604522.224071@grendel.zope.com>
damitha@opensource.lk writes:
> Hi, Is expat thread safe?
As long as each parser object is passed into Expat by only one thread
at a time, you'll be fine. Anything else you will need to protect by
explicit locks.
-Fred
--
Fred L. Drake, Jr.
PythonLabs at Zope Corporation
From rolf at pointsman.de Wed Nov 19 21:20:30 2003
From: rolf at pointsman.de (rolf@pointsman.de)
Date: Wed Nov 19 21:20:17 2003
Subject: [Expat-discuss] Is expat thread safe?
In-Reply-To: <16315.43980.604522.224071@grendel.zope.com>
Message-ID: <20031120022033.32C4370A75@pointsman.pointsman.de>
On 19 Nov, Fred L. Drake, Jr. wrote:
> damitha@opensource.lk writes:
> > Hi, Is expat thread safe?
>
> As long as each parser object is passed into Expat by only one thread
> at a time, you'll be fine. Anything else you will need to protect by
> explicit locks.
Fred,
now you've confused me. Please, could you rephrase this?
Thanks
rolf
From fdrake at acm.org Wed Nov 19 23:42:48 2003
From: fdrake at acm.org (Fred L. Drake, Jr.)
Date: Wed Nov 19 23:43:01 2003
Subject: [Expat-discuss] Is expat thread safe?
In-Reply-To: <20031120022033.32C4370A75@pointsman.pointsman.de>
References: <16315.43980.604522.224071@grendel.zope.com>
<20031120022033.32C4370A75@pointsman.pointsman.de>
Message-ID: <16316.17992.659934.822514@grendel.zope.com>
rolf@pointsman.de writes:
> now you've confused me.
That's not a good sign. Appearantly I should have gone to sleep
sooner. ;-) Re-reading my first response certainly gives me that
impression.
> Please, could you rephrase this?
Each parser object can handle just one document at a time, and can
only have one call active at a time. It doesn't really care that all
calls come from the same thread, though that's an easy way to ensure
serialization.
-Fred
--
Fred L. Drake, Jr.
PythonLabs at Zope Corporation
From damitha at opensource.lk Thu Nov 20 07:25:27 2003
From: damitha at opensource.lk (damitha@opensource.lk)
Date: Thu Nov 20 07:25:34 2003
Subject: [Expat-discuss] XML_GetBuffer
Message-ID: <33139.220.247.247.26.1069331127.squirrel@webmail.pair.com>
Hi,
If someone give me answers to the following two questions it is
greatly appreciated.
My first question is,
My application is receiving buffers of varying length and I need
to parse them as I receive them. Is it possible to parse these
buffers directly without calling XML_GetBuffer function to get
a buffer from expat?.
My second question is,
If the answer to the first question is yes, will the expat
delete my buffer?.
I actually tested these and got the answer to the
first 'yes' and to the second 'no'. Just asking to confirm that.
thanks in advance
damitha
From karl at waclawek.net Thu Nov 20 09:02:29 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Thu Nov 20 09:02:36 2003
Subject: [Expat-discuss] XML_GetBuffer
References: <33139.220.247.247.26.1069331127.squirrel@webmail.pair.com>
Message-ID: <002101c3af6e$ef49cb40$9e539696@citkwaclaww2k>
> If someone give me answers to the following two questions it is
> greatly appreciated.
>
>
> My first question is,
> My application is receiving buffers of varying length and I need
> to parse them as I receive them. Is it possible to parse these
> buffers directly without calling XML_GetBuffer function to get
> a buffer from expat?.
Yes, just use XML_Parse(). However, this will still copy the data
to Expat's internal buffer - which Expat creates with XML_GetBuffer().
Performance-wise this does not gain you anything.
However, if you build Expat with XML_CONTEXT_BYTES undefined then
it will parse directly from your buffer, unless there were unparsed
data left from the previous buffer - in which case it will still copy
all data internally (and this would be the more likely case).
> My second question is,
>
> If the answer to the first question is yes, will the expat
> delete my buffer?.
>
> I actually tested these and got the answer to the
> first 'yes' and to the second 'no'. Just asking to confirm that.
Confirmed.
Btw, the best approach performance-wise would be if your
application could use a buffer created with XML_GetBuffer().
That would avoid double copying.
Karl
From ravi_iics at yahoo.co.uk Tue Nov 25 01:27:33 2003
From: ravi_iics at yahoo.co.uk (=?iso-8859-1?q?ravi=20alwis?=)
Date: Tue Nov 25 01:27:38 2003
Subject: [Expat-discuss] XML Pull Support
Message-ID: <20031125062733.97579.qmail@web25007.mail.ukl.yahoo.com>
Hi
Is expat supporting for the xml pull model.
Ravi
________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk
From gstein at lyra.org Tue Nov 25 13:12:47 2003
From: gstein at lyra.org (Greg Stein)
Date: Tue Nov 25 13:14:51 2003
Subject: [Expat-discuss] XML Pull Support
In-Reply-To: <20031125062733.97579.qmail@web25007.mail.ukl.yahoo.com>;
from ravi_iics@yahoo.co.uk on Tue, Nov 25, 2003 at 06:27:33AM
+0000
References: <20031125062733.97579.qmail@web25007.mail.ukl.yahoo.com>
Message-ID: <20031125101247.H11264@lyra.org>
On Tue, Nov 25, 2003 at 06:27:33AM +0000, ravi alwis wrote:
> Hi
>
> Is expat supporting for the xml pull model.
Not yet. It is planned for the next-generation Expat.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
From karl at waclawek.net Tue Nov 25 19:07:11 2003
From: karl at waclawek.net (Karl Waclawek)
Date: Tue Nov 25 19:04:09 2003
Subject: [Expat-discuss] XML Pull Support
References: <20031125062733.97579.qmail@web25007.mail.ukl.yahoo.com>
Message-ID: <00b101c3b3b1$3f6542d0$0207a8c0@karl>
> Hi
>
> Is expat supporting for the xml pull model.
>
Is it implemented as a specific API? No, not yet.
However, I recently added patch #835123 - check
http://sourceforge.net/tracker/index.php?func=detail&aid=835123&group_id=10127&atid=310127
which should enable pull-like operation by allowing you
to stop and resume the parser.
How to implement pull operation on top of a push
parser is described (in principle) here:
http://lists.xml.org/archives/xml-dev/200311/msg00392.html
Karl
From smesser at xmission.com Thu Nov 27 01:08:49 2003
From: smesser at xmission.com (Steve Messer)
Date: Thu Nov 27 01:08:46 2003
Subject: [Expat-discuss] Beginner Question
Message-ID:
I am sure this is probably not good practice but it suits my needs. I am
currently using new (allocating memory) in the start handler. At the
termination of my program during cleanup when I try to delete the memory
that was newed in the start handler the program crashes. Why would this be?
-Steve
From fdrake at acm.org Thu Nov 27 02:05:45 2003
From: fdrake at acm.org (Fred L. Drake, Jr.)
Date: Thu Nov 27 02:07:20 2003
Subject: [Expat-discuss] Beginner Question
In-Reply-To:
References:
Message-ID: <16325.41545.772350.44320@grendel.fdrake.net>
Steve Messer writes:
> I am sure this is probably not good practice but it suits my needs. I am
> currently using new (allocating memory) in the start handler. At the
> termination of my program during cleanup when I try to delete the memory
> that was newed in the start handler the program crashes. Why would this be?
This is definately not the right list for this either.
My C++ is a bit rusty, but offhand I don't see any reason for this to
be a problem. Perhaps posting a short sample that exhibits the
problem will make it easier for people to figure out; creating a
shorter example that exhibits the problem may well make it easier for
you to see what's wrong.
-Fred
--
Fred L. Drake, Jr.
PythonLabs at Zope Corporation
From 11mjazbdg02 at sneakemail.com Thu Nov 27 04:52:37 2003
From: 11mjazbdg02 at sneakemail.com (Mark)
Date: Thu Nov 27 04:52:40 2003
Subject: [Expat-discuss] CR characters are lost when processing a CDATA
section
Message-ID: <6175-10729@sneakemail.com>
Hi,
Expat 1.95.6
I am processing CDATA sections using my character data handler. At the
moment I get all characters except for the CR (Carriage return) character.
It is important I get all data from the CDATA section. How can this
be achieved?
Best Regards,
Mark
From 11mjazbdg02 at sneakemail.com Thu Nov 27 10:57:52 2003
From: 11mjazbdg02 at sneakemail.com (Mark)
Date: Thu Nov 27 10:57:55 2003
Subject: [Expat-discuss] (no subject)
Message-ID: <22803-66197@sneakemail.com>
> Infact all CRs (and CRLF pairs) are converted into single LF. This is
> something that all conformant
> parsers do, I believe even MSXML does this. There might be
> some setting in
> parser that preserves
> CRs or there might not. So you must handle these at
> application level.
> Sometimes you can just work with (unix) style LFs, usually this isn't
> possible when working in windows and you want to "visualize"
> your data to
> the user though. So you need to convert them to CRLFs, nasty
> job, I know.
>
> with respect,
>
>
> see XML 1.0 spec
> http://www.xml.com/axml/target.html#sec-line-ends
>
Toni, thanks for the reply. I understand it a bit better now.
However I cannot just translate all LF's to CRLF's since our data can
contain LF or CRLF and this must be preserved. Do you have any idea how I could solve this?
Thanks, Mark
From toni.uusitalo at pan.nu Thu Nov 27 10:47:00 2003
From: toni.uusitalo at pan.nu (Toni Uusitalo)
Date: Thu Nov 27 11:47:06 2003
Subject: [Expat-discuss] CR characters are lost when processing a
CDATA section
Message-ID: <6.0.0.22.0.20031127173604.00ba7720@pop.saunalahti.fi>
Infact all CRs (and CRLF pairs) are converted into single LF. This is
something that all conformant
parsers do, I believe even MSXML does this. There might be some setting in
parser that preserves
CRs or there might not. So you must handle these at application level.
Sometimes you can just work with (unix) style LFs, usually this isn't
possible when working in windows and you want to "visualize" your data to
the user though. So you need to convert them to CRLFs, nasty job, I know.
with respect,
see XML 1.0 spec
http://www.xml.com/axml/target.html#sec-line-ends
From toni.uusitalo at pan.nu Thu Nov 27 11:16:16 2003
From: toni.uusitalo at pan.nu (Toni Uusitalo)
Date: Thu Nov 27 11:47:07 2003
Subject: [Expat-discuss] (no subject)
Message-ID: <6.0.0.22.0.20031127180611.01fb8b18@pop.saunalahti.fi>
>Toni, thanks for the reply. I understand it a bit better now.
>
>
>
>However I cannot just translate all LF's to CRLF's since our data can
>
>contain LF or CRLF and this must be preserved. Do you have any idea how
I could solve this?
Elsewhere you could use
entities (converting input CRs into
etc - ugh!), but not in CDATA section.
I suppose you can decide to use CR or LF or CRLF in CDATA section. No? If
not, I don't know a way to solve this, sorry.
with respect.
From regis.st-gelais at laubrass.com Thu Nov 27 13:51:07 2003
From: regis.st-gelais at laubrass.com (=?iso-8859-1?Q?R=E9gis_St-Gelais?=)
Date: Thu Nov 27 14:13:52 2003
Subject: [Expat-discuss] CR characters are lost when processing a
CDATAsection
References: <6175-10729@sneakemail.com>
Message-ID: <002b01c3b517$6b8a3200$647ba8c0@regis>
----- Original Message -----
From: Mark
To: expat-discuss@libexpat.org
Sent: Thursday, November 27, 2003 4:52 AM
Subject: [Expat-discuss] CR characters are lost when processing a
CDATAsection
I my data section I replace CR and LF at save time by other caracteres that
wont be used and back to CR ou LF at reading time.
Regis