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

Re: http_parse_xml_string usage



Hi Rick,

> I'm clearly not understanding something. The string to be parsed is an
> RPG variable in EBCDIC. Based on a literal reading of the documentation,
> "peCCSID = (input) CCSID of string to be parsed", I thought the
> following would work, but it did not.

The following (complete program) works for me.  Does it work for you?


      H DFTACTGRP(*NO) BNDDIR('HTTPAPI')

       /copy httpapi_h

      D BegTag          PR
      D   UserData                      *   value
      D   depth                       10I 0 value
      D   name                      1024A   varying const
      D   path                     24576A   varying const
      D   attrs                         *   dim(32767)
      D                                     const options(*varsize)
      D EndTag          PR
      D   UserData                      *   value
      D   depth                       10I 0 value
      D   name                      1024A   varying const
      D   path                     24576A   varying const
      D   value                    65535A   varying const
      D   attrs                         *   dim(32767)
      D                                     const options(*varsize)

      D Xmldata         s             50a
      D rc              s             10i 0
       /free

          xmldata = '<OrderID>123</OrderID>';

          rc = http_parse_xml_string( %addr(xmldata)
                                    : %len(%trimr(xmldata))
                                    : 0
                                    : %paddr(BegTag)
                                    : %paddr(EndTag)
                                    : *null );
          *inlr = *on;

       /end-free


      P BegTag          B
      D BegTag          PI
      D   UserData                      *   value
      D   depth                       10I 0 value
      D   name                      1024A   varying const
      D   path                     24576A   varying const
      D   attrs                         *   dim(32767)
      D                                     const options(*varsize)
       /free
          // do nothing
       /end-free
      P                 E


      P EndTag          B
      D EndTag          PI
      D   UserData                      *   value
      D   depth                       10I 0 value
      D   name                      1024A   varying const
      D   path                     24576A   varying const
      D   value                    65535A   varying const
      D   attrs                         *   dim(32767)
      D                                     const options(*varsize)
      D testme          s             50
       /free
          if name = 'OrderID';
             testme = value;
             dsply testme;
          endif;
       /end-free
      P                 E
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------