You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Vagelis Blathras <vb...@mail.ariadne-t.gr> on 2000/05/15 20:03:20 UTC

Again Problem Encountered with InputSource



> I'm not sure exactly what is going on, but I have to question why you are
> doign all of the casts in the code you posted? There should be no reason to
> be doing all those casts of hte character strings. If you do have to do
> them, then that's a sign that something is definitely wrong.

Well, ok, these casts were not necessary, and were removed. But the problem
persists.

Let me, please, re write the problem that occurs :

I have made a dll with a simple function, in order to call it with a file name
as a parameter, and parse that file. When I use the
parse.parse(char *filename) format of the parsing call , everything is ok, and
I can call my function several times, one after the other - not simultaneously.

But, since I would like to have a default encoding of ISO-8859-1 in the XML
parsing if the XML file does not provide with one, then I use the following :

 static XMLCh* tmpstr=XMLString::transcode(XMLResultFile);
 LocalFileInputSource *InputSrcDef;
 InputSrcDef = new LocalFileInputSource(tmpstr);

// Set default encoding to ISO-8859-1
 tmpstr=XMLString::transcode("ISO-8859-1");
 InputSrcDef->setEncoding(tmpstr);

and then in a try...catch a
 parser->parse(*InputSrcDef);

Here is the problem. When the function is called for the first time, everything
works ok. From the second time, it stops working, and the parser reports a
fatal error on
Line 0 , Column 0 , that makes me thing that it cannot read the file again.




Re: Again Problem Encountered with InputSource

Posted by Dean Roddey <dr...@charmedquark.com>.
You cannot use Debug runtime if you link against the production DLLs, since
they use the non-debug runtime. Change you runtime to the non-Debug and see
if your problems go away. If so, then that is the problem. If you want to
use the Debug runtime, you must rebuild the parser and ICU in debug mode so
that you are using the same runtime.

--------------------------
Dean Roddey
The CIDLib Class Libraries
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"Give me immortality, or give me death"

----- Original Message -----
From: "Vagelis Blathras" <vb...@mail.ariadne-t.gr>
To: <xe...@xml.apache.org>
Sent: Thursday, May 18, 2000 11:11 AM
Subject: Re: Again Problem Encountered with InputSource


> > row and they all worked fine. Are you sure that you've built your DLL
with
> > the appropriate runtime? You should be using the Multi-threaded DLL
runtime,
> > if you are linking against our production build.
>
> Yes, I am using Multi-threaded DLL . Project Settings -> C/C++ -> Code
> Generation -> Use Run time library , is Debug MultiThreaded, since I am in
debug
> stages :-)




Re: Again Problem Encountered with InputSource

Posted by Vagelis Blathras <vb...@mail.ariadne-t.gr>.
> row and they all worked fine. Are you sure that you've built your DLL with
> the appropriate runtime? You should be using the Multi-threaded DLL runtime,
> if you are linking against our production build.

Yes, I am using Multi-threaded DLL . Project Settings -> C/C++ -> Code
Generation -> Use Run time library , is Debug MultiThreaded, since I am in debug
stages :-)

Also, I use MFC in a Static library , if this matters .....

Thank you for your answers....



Re: Again Problem Encountered with InputSource

Posted by Dean Roddey <dr...@charmedquark.com>.
This seems to work fine for me, at least in a simple scenario. I modified
DOMCount to use a local file input source, and the called parse 5 times in a
row and they all worked fine. Are you sure that you've built your DLL with
the appropriate runtime? You should be using the Multi-threaded DLL runtime,
if you are linking against our production build.

--------------------------
Dean Roddey
The CIDLib Class Libraries
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"Give me immortality, or give me death"

----- Original Message -----
From: "Andy Heninger" <an...@jtcsv.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, May 17, 2000 2:14 PM
Subject: Re: Again Problem Encountered with InputSource


> What you are doing should work.
> I have entered a bug for the problem.
>
> Andy Heninger
> IBM XML Technology Group, Cupertino, CA
> heninger@us.ibm.com
>
>
>
>
> ----- Original Message -----
> From: "Vagelis Blathras" <vb...@mail.ariadne-t.gr>
> To: <xe...@xml.apache.org>; <dr...@charmedquark.com>
> Sent: Monday, May 15, 2000 11:03 AM
> Subject: Again Problem Encountered with InputSource
>



Re: Again Problem Encountered with InputSource

Posted by Vagelis Blathras <vb...@mail.ariadne-t.gr>.
Dean Roddey wrote:

> You cannot use Debug runtime if you link against the production DLLs, since
> they use the non-debug runtime. Change you runtime to the non-Debug and see
> if your problems go away. If so, then that is the problem. If you want to

I rebuilt the program with non-debug runtime and the problem is still there,
unfortunatelly... :-/



Re: Again Problem Encountered with InputSource

Posted by Vagelis Blathras <vb...@mail.ariadne-t.gr>.
> What you are doing should work.
> I have entered a bug for the problem.
>

Thank you for your response. As you will see in another mail of mine, I use
(correctly hopefully) MultiThreaded DLL support, statically linked, debug
version, if this matters...



Re: Again Problem Encountered with InputSource

Posted by Andy Heninger <an...@jtcsv.com>.
What you are doing should work.
I have entered a bug for the problem.

Andy Heninger
IBM XML Technology Group, Cupertino, CA
heninger@us.ibm.com




----- Original Message -----
From: "Vagelis Blathras" <vb...@mail.ariadne-t.gr>
To: <xe...@xml.apache.org>; <dr...@charmedquark.com>
Sent: Monday, May 15, 2000 11:03 AM
Subject: Again Problem Encountered with InputSource


>
>
>
> > I'm not sure exactly what is going on, but I have to question why you
are
> > doign all of the casts in the code you posted? There should be no
reason to
> > be doing all those casts of hte character strings. If you do have to
do
> > them, then that's a sign that something is definitely wrong.
>
> Well, ok, these casts were not necessary, and were removed. But the
problem
> persists.
>
> Let me, please, re write the problem that occurs :
>
> I have made a dll with a simple function, in order to call it with a
file name
> as a parameter, and parse that file. When I use the
> parse.parse(char *filename) format of the parsing call , everything is
ok, and
> I can call my function several times, one after the other - not
simultaneously.
>
> But, since I would like to have a default encoding of ISO-8859-1 in the
XML
> parsing if the XML file does not provide with one, then I use the
following :
>
>  static XMLCh* tmpstr=XMLString::transcode(XMLResultFile);
>  LocalFileInputSource *InputSrcDef;
>  InputSrcDef = new LocalFileInputSource(tmpstr);
>
> // Set default encoding to ISO-8859-1
>  tmpstr=XMLString::transcode("ISO-8859-1");
>  InputSrcDef->setEncoding(tmpstr);
>
> and then in a try...catch a
>  parser->parse(*InputSrcDef);
>
> Here is the problem. When the function is called for the first time,
everything
> works ok. From the second time, it stops working, and the parser reports
a
> fatal error on
> Line 0 , Column 0 , that makes me thing that it cannot read the file
again.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>