Skip to main content
Paddy R ha fatto una domanda in #Apex
Hi All,

Any idea how can I parse the below Rest API response using Apex code and how can I display this pageblock section.

<bns:QueryResult xmlns:bns="http://api.platform.boomi.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfResults="3">

<bns:result xsi:type="bns:Process" id="XXXXXX" name="AAA"/>

<bns:result xsi:type="bns:Process" id="XXXXXXXX" name="BBBB"/>

<bns:result xsi:type="bns:Process" id="XXXXXX" name="CCC"/>

</bns:QueryResult>

Regards,

PR
1 risposta
  1. 20 apr 2016, 19:06
    I am able to do that using the below code:

                if(response!=null && response.getBody()!=null) 

                 {

                    body=response.getBody();

                    dom=new XMLDom(body);            

                    //for( xmldom.element f: dom.getElementsByTagName('getProcessResponse'))

                    

                    for( xmldom.element f: dom.getElementsByTagName('QueryResult'))

                    {

                        List<string> ids= New List <string> (); 

                        system.debug('here--> dom QueryResult=='+dom.getElementsByTagName('QueryResult'));

                        for( xmldom.element e: dom.getElementsByTagName('result'))

                        {                    

                            system.debug('here 2--> dom Result=='+dom.getElementsByTagName('result'));

                            system.debug('here 3-->  acc.name=='+ (String)e.getAttribute('name'));

                             system.debug('here 3-->  acc.id=='+ (String)e.getAttribute('id'));