× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You can definitely parse a buffer with XML4PR400, and it is pretty much the
same whether you are using DOM or SAX.  Here is some code that should help
you out.  It isn't complete, but it will get you going in the right
direction. . .


     P XMLSAX_parseMemory...
     P                 B                   Export
     D XMLSAX_parseMemory...
     D                 PI
     D  pXML                      65535A   Value
     D  pValidation                  10I 0 Value Options(*NoPass)
     D  pNameSpaces                  10I 0 Value Options(*NoPass)

     D docLength       S             10I 0 Inz(%Size(pXML))
     D SAXParser       S               *
     D memBuff         S               *
     D docName         S               *
     D temp            S            100A
     D begXMLDecl      S             10I 0
     D endXMLDecl      S             10I 0
      /Free

       Select;
       When %Parms > 1;
         SAXParser = XMLSAX_createParser(pValidation);
       When %Parms > 2;
         SAXParser = XMLSAX_createParser(pValidation: pNameSpaces);
       EndSl;

       temp = %Subst(pXML:1:100);
       begXMLDecl = %Scan('<?':temp);
       endXMLDecl = %Scan('?>':temp);

       // If an XML Declaration wasn't found, add one because the document
wont parse without one.
       // If one was found, just replace it with one that is guarnteed to
work.
       If begXMLDecl < 1;
         pXML = '<?xml version="1.0" encoding="IBM037"?>' + x'25' + pXML;
       Else;
         pXML = %Replace(
           '<?xml version="1.0" encoding="IBM037"?>':
           pXML: begXMLDecl: endXMLDecl-begXMLDecl+2);
       EndIf;

       XMLSAX_setEncoding(Qxml_UNICODE);

       docName = %Alloc(10);
       %Str(docName:6) = 'MemDoc';

       memBuff =
         QxmlMemBufInputSource_new(
           %Addr(pXML): docLength: docName: Qxml_CCSID37: 0: 0);

       QxmlSAXParser_parse_inputSource(SAXParser: memBuff);
       QxmlMemBufInputSource_delete(memBuff);

       XMLSAX_destroySAXParser(SAXParser);

       Return;

      /End-Free
     P XMLSAX_parseMemory...
     P                 E  








-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of vinciamo@xxxxxx
Sent: Thursday, May 06, 2004 12:14 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: SOAP and RPG

I'm developing an rpg as web service program, and i want to use soap
protocol to call it!
I can't use xml4pr400 because it riquire an xml file not xml string!
Is there a way to parse xml-soap string buffer into RPG array?
Thanks in advance!
Regards!!
Vincenzo!!  

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.