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

Re: EXPAT service program which comes with HTTPAPI



Hi Garry,

The data that's passed to your callbacks will be in UTF-16 format, not 
EBCDIC.  If you try to treat it as a zero-terminated string (as is 
standard in C) you'll have a bad time of it, since each character is two 
bytes long, and the first byte of most common characters is 0x00.  So 
you'll end up will an "empty string".

To determine the size of the element names, attribute names & attribute 
values, you'll need to look for two consecutive bytes set to 0x00.

In the character data handler, the size of the string should be passed 
as one of the args to your function, so you won't want to search for 
zeros in that case.

Once you get the data, use iconv() to convert it from UTF-16 (IBM CCSID 
1200) to EBCDIC...  then you'll have an ordinary string you can use for 
your own purposes.


Garry Taylor wrote:
> Hi All,
> I'm attempting to use the EXPAT service program which is supplied with
> HTTPAPI, and I'm linking it to my program like so:
> 
> CRTPGM PGM(THEGMAN1/TESTEXPAT) MODULE(THEGMAN1/EXPATMAIN)
> BNDSRVPGM(LIBHTTP/EXPAT)
> 
> I got the Expat header files from the source distribution of Expat,
> and compiled one of the example programs which is supplied. All of
> this went without incident, until I run the PGM, when it processes the
> XML without error, but on the start element handler, it does not print
> out either name or any of the element attributes, although it does
> print out the depth in the XML tree of each element and no parse error
> is given.
> 
> If I deliberately invalidate the XML, this is reported perfectly, so I
> think the parser is working just fine, but the printing is not.
> 
> I'm doing all this in C, and my XML file is untouched UTF8, so at what
> point can this text be converted to EBCDIC to get printed, does this
> sound like the problem?
> 
> Any ideas what the problem is?
> 
> Thanks
> 
> Garry
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
> 

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------