private void ReadElement(XmlNode parentNode, Property property) { if (parentNode[property.Name] == null) { property.Value = null; property.NotSet = true; } else if ((parentNode[property.Name].Attributes["nil"] != null) && (parentNode[property.Name].Attributes["nil"].Value.Equals(XmlConvert.ToString(true), StringComparison.InvariantCultureIgnoreCase))) { property.Value = null; } /* added by: msassanelli * 07-09-10 * We have to check for the type of the property. Properties that do not accept an empty string as value * have to be handled as a not set property. * i.e. A tag is given that represents a boolean type and no innerText exists: It is handled as if the tag does not exist. */ else if ((parentNode[property.Name].InnerText == "") && (property.TypeCode != TypeCode.String && property.TypeCode != TypeCode.Object)) { property.Value = null; property.NotSet = true; } /* end msassanelli */ else { property.setXMLValue(parentNode[property.Name].InnerText); } }
private void ReadElement(XmlNode parentNode, Property property) { if (parentNode[property.Name] == null) { property.Value = null; property.NotSet = true; } else if ((parentNode[property.Name].Attributes["nil"] != null) && (parentNode[property.Name].Attributes["nil"].Value.Equals(XmlConvert.ToString(true), StringComparison.InvariantCultureIgnoreCase))) property.Value = null; /* added by: msassanelli * 07-09-10 * We have to check for the type of the property. Properties that do not accept an empty string as value * have to be handled as a not set property. * i.e. A tag is given that represents a boolean type and no innerText exists: It is handled as if the tag does not exist. */ else if ((parentNode[property.Name].InnerText == "") && (property.TypeCode != TypeCode.String && property.TypeCode != TypeCode.Object)) { property.Value = null; property.NotSet = true; } /* end msassanelli */ else property.setXMLValue(parentNode[property.Name].InnerText); }