I am passing an accountid as input from an XML file as shown, which will be parsed later and will be used in our code:
123456
You can't use String.isEmpty() if it is null. Best is to have your own method to check null or empty.
String.isEmpty()
public static boolean isBlankOrNull(String str) { return (str == null || "".equals(str.trim())); }