I have below code that fails to execute in developer console, I receive the following error: Attempt to de-reference a null object. Can someone please help here?
Apex class:
public class DomDocument1 {
public void parseResponseDom(){
string xml = '<Order>pl.map_00NF0000008ZKQu_012F00000011jfx={\'Lupron Ped Call Plan update\':\'fwAA\'}; pl.vals_00NF0000008ZKQu_012F00000011jfx=[\'N/A\',\'N/A\',\'Include - High\',\'Include - High\',\'Include - Medium\',\'Include - Medium\',\'Include - Low\',\'Include - Low\',\'Remove - Deceased/Retired\',\'Remove - Deceased/Retired\',\'Remove - Moved out\']</Order>';
Dom.Document doc = new Dom.Document();
doc.load(xml);
Dom.XMLNode ordDtls = doc.getRootElement();
String OrderDetailId= ordDtls.getChildElement('pl.map_00NF0000008ZKQu_012F00000011jfx', null).getText();
System.debug('OrderDtlID: ' + OrderDetailId);
for(Dom.XMLNode child : ordDtls.getChildElements()) {
System.debug(child.getText());
}
}
}
ordDtls.getChildElement()
butordDtls
is not null.