+ 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.