function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vishnu YadavalliVishnu Yadavalli 

How to capture fields in XML and store in salesforce.

I have the forrlowing XML code which contain 4 Fields.

 

  Dom.Document doc = new Dom.Document();
        doc.load(res.getBody());
        List<string> lstValues=new List<String>();
         for(DOM.XMLNode rootnode : doc.getRootElement().getChildElements()){
              for(DOM.XMLNode CompanyList: rootnode.getChildElements()){

                  for(DOM.XMLNode Company: CompanyList.getChildElements()){
                      lstValues.add(company.getText());
                  }    
              }
         }

 


Data is comming in the following format.

 

 

<User>
      <CompanyId>4</CompanyId>
      <FirstName>sample string 2</FirstName>
      <LastName>sample string 3</LastName>
      <UserId>1</UserId>
    </User>

How do capture this data and store in salesforce.