public static FurnitureType ParseFromXML(XmlDocument doc, string node) { var x = doc.SelectSingleNode("/furniture/decoration[@name='" + node + "']")?.Name ?? doc.SelectSingleNode("/furniture/storage[@name='" + node + "']").Name; if (x == "storage") { return(StorageType.ParseFromXML(doc, node)); } else if (x == "decoration") { return(DecorationType.ParseFromXML(doc, node)); } return(null); }