Error
Attempt to de-reference a Null object.
in my below httpcallout I get above error for line
if(xroot.getChildElement('State', null).gettext() != null)
my callous code looks as below .
resp = res.getBody();
system.debug('res :' + resp); // resp == resXML
Dom.Document docx = new Dom.Document();
docx.load(resp);
system.debug('Docx' + docx);
Dom.XmlNode xroot = docx.getRootElement();
if(xroot.getChildElement('ZipCode',null)!= null){
if(xroot.getChildElement('State', null).gettext() != null){
String state = xroot.getChildElement('ZipCode',null).getChildElement('State',null).getText();
c.MailingState = state;
system.debug('State'+ state);