Skip to main content
added 12 characters in body
Source Link
sfdcfox
  • 501.6k
  • 21
  • 473
  • 828

Methods can't be called on a null reference; it looks like getChildElement('State',null) is returning a null value, so you should check that first:

Dom.XmlNode stateNode = xroot.getChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {

Based on the additional comment, it looks like you need to read the ZipCode node to get to the State:

Dom.XmlNode zipNode = xroot.getChildElement('ZipCode',null),
    stateNode = zipNode == null? null: zipNode.getgetChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {

Methods can't be called on a null reference; it looks like getChildElement('State',null) is returning a null value, so you should check that first:

Dom.XmlNode stateNode = xroot.getChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {

Based on the additional comment, it looks like you need to read the ZipCode node to get to the State:

Dom.XmlNode zipNode = xroot.getChildElement('ZipCode',null),
    stateNode = zipNode == null? null: zipNode.get('State',null);
if(stateNode != null && stateNode.getText() != null) {

Methods can't be called on a null reference; it looks like getChildElement('State',null) is returning a null value, so you should check that first:

Dom.XmlNode stateNode = xroot.getChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {

Based on the additional comment, it looks like you need to read the ZipCode node to get to the State:

Dom.XmlNode zipNode = xroot.getChildElement('ZipCode',null),
    stateNode = zipNode == null? null: zipNode.getChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {
added 312 characters in body
Source Link
sfdcfox
  • 501.6k
  • 21
  • 473
  • 828

Methods can't be called on a null reference; it looks like getChildElement('State',null) is returning a null value, so you should check that first:

Dom.XmlNode stateNode = xroot.getChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {

Based on the additional comment, it looks like you need to read the ZipCode node to get to the State:

Dom.XmlNode zipNode = xroot.getChildElement('ZipCode',null),
    stateNode = zipNode == null? null: zipNode.get('State',null);
if(stateNode != null && stateNode.getText() != null) {

Methods can't be called on a null reference; it looks like getChildElement('State',null) is returning a null value, so you should check that first:

Dom.XmlNode stateNode = xroot.getChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {

Methods can't be called on a null reference; it looks like getChildElement('State',null) is returning a null value, so you should check that first:

Dom.XmlNode stateNode = xroot.getChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {

Based on the additional comment, it looks like you need to read the ZipCode node to get to the State:

Dom.XmlNode zipNode = xroot.getChildElement('ZipCode',null),
    stateNode = zipNode == null? null: zipNode.get('State',null);
if(stateNode != null && stateNode.getText() != null) {
Source Link
sfdcfox
  • 501.6k
  • 21
  • 473
  • 828

Methods can't be called on a null reference; it looks like getChildElement('State',null) is returning a null value, so you should check that first:

Dom.XmlNode stateNode = xroot.getChildElement('State',null);
if(stateNode != null && stateNode.getText() != null) {