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

RE: Problem parsing XML with EXPAT



This isn't technically HTTPAPI. It is EXPAT which is bundled with
HTTPAPI.
Here's what my start element receiver procedure looks like (taken
directly from the OUTLINE example included with the EXPAT download):
//----------------------------------------------------------------------
--
// Start: Callback procedure for start of XML element
|
//----------------------------------------------------------------------
--
P start           B
D start           PI
D   data                          *   value
D   elem                     16383C   options(*varsize)
D   attr                          *   dim(32767) options(*varsize)

D len             s             10I 0
D elemName        s          16383C   varying

 /free

  depth = depth + 1;

  len = %scan(u'0000': elem) - 1;
  if (len < 1);
     return;
  endif;

  elemName = %subst(elem:1:len);

 /end-free
P                 E     
Originally I had elem defined as a pointer and was using %Str() to get
the string value. 

The data type C is for UCS-2 (Fixed or Variable-length format) data. 

Here's something I read from Scott's expat website:

Starting with version 2.0.0, I have Expat compiled with the XML_UNICODE
symbol defined. This tells Expat to output UTF-16 when calling your
procedures. This is a good thing for RPG programmers because RPG
supports UTF-16 natively. (You code it as UCS2, then tell it to use
CCSID(1200) which is UTF-16.) 

Based on that I'm assuming expat will always return UCS-2 data to RPG.

That's one more thing I should have paid attention to yesterday.

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
wouter.desaedeleer@xxxxxxxxxx
Sent: Thursday, November 29, 2007 9:30 AM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: Problem parsing XML with EXPAT

------------

Changing my program to receive the string in the (UCS-2) data type
solved my problem. 

How did you do this? 

Sorry for these questions, but I have no experience with HTTPAPI.

Thanks,

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