+ Start a Discussion

Upsert Operation for XMl string

Hi, I am performing a Apex callout and am retreving data as a xml string. Now i would want to have my data used for Upsert Operation on Files__c Object.Below is how my xml 




  <APID>0034000000SiXLtAAN</APID>  <Photo1>//Bait/Applications/APApplications/AP0802720.Song/Photos/Photo1.jpg</Photo1>




          <InactivePhoto1_Dt>11/10/2011 </InactivePhoto1_Dt>




  Below is how am retriving values           

System.debug('BharathXML:' +XmlString);
            GAPOrg.AjaxSoap Servicestub = new GAPOrg.AjaxSoap();
            ServiceResult = Servicestub.GAPAPFilesGlobalRun(XmlString);
            System.debug('XmlResult:' +ServiceResult);            
            Files__c  upsertfiles = new Files__c();
            Dom.Document docx = new Dom.Document();
            Dom.Xmlnode xroot = docx.getRootElement();

  Dom.Xmlnode [] xrec = xroot.getChildElements();

And the values that need to upserted for FIles__c are

For each photo file, create one row to be inserted into Files__c in SFDC.  Need the following columns:

Contact id  (from AP_Application__c.Au_Pair__c)

Application Id (from AP_Application__c.Id)

Path (AP_Application__c.Photo1__c)

External Id (AP_Application__c. ExernalIdPhoto1)

Inactive Dt (new column, will map to Files__c.Inactive_Dt__c)



Use External Id to match Files__c. ExternalId

Files__c. AP_Application__c  = Application id

Files__c.Contact__c = Contact id

Files__c.Path__c = Path