[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: FW: [OFF TOPIC] Using Expat with RPGLE part 2.



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>

Hi Nicolas,

I think you're doing the right thing. The only reason the length was set to 132 is that I was printing the result on a 132 column print file, so I knew I'd never need more than that.

You're absolutely right that the buffer in the character handler should be as large as the one in the mainline. Also, I'd recommend using iconv() instead of QDCXLATE, as suggested in "Part 3", since you can make it work with any character set.


On Fri, 1 Apr 2005, Nicolas Machado wrote:

Hi everybody and Scott.


I found the problem.
The length of the variable "val" to hold character data is 132 bytes but in
my exercise "len" is 6865
I mean that I receive more data that the variable can contain

So, first I think that the problem was with the call to QDCXLATE, and I
create a variable with a length of 32767 ;

xlatebuff = %subst(string:1:len)

because we area reading in blocks of 8192, there will be no problems with
reading more than the api can receive.

The problem then was triggered by the for .. to because "len" is greater
than the length of "val".

  184           newval = '';
  185           for x = 1 to len;
  186              if ( %subst(val:x:1) >= x'40' );
  187                  newval = newval + %subst(val:x:1);
  188              endif;
  189           endfor;

It's interesting that the error raises to the XML_Parse function, even that
the error was in a subprocedure of the caller of XML_Parse.
Yes, that's because of %PADDR.

I'll change variable val and newval to 8192 bytes and see what happend.

Please, If I'm wrong, let me know :).


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------