public ElectricityProduct(XmlNode xmlNode) { XmlNodeList typeNodeList = xmlNode.SelectNodes("type"); if (typeNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in typeNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { typeIDRef = item.Attributes["id"].Name; ElectricityProductTypeEnum ob = ElectricityProductTypeEnum(); IDManager.SetID(typeIDRef, ob); } else if (item.Attributes.ToString() == "href") { typeIDRef = item.Attributes["href"].Name; } else { type = new ElectricityProductTypeEnum(item); } } } XmlNodeList voltageNodeList = xmlNode.SelectNodes("voltage"); if (voltageNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in voltageNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { voltageIDRef = item.Attributes["id"].Name; PositiveDecimal ob = PositiveDecimal(); IDManager.SetID(voltageIDRef, ob); } else if (item.Attributes.ToString() == "href") { voltageIDRef = item.Attributes["href"].Name; } else { voltage = new PositiveDecimal(item); } } } }
public ElectricityProduct(XmlNode xmlNode) { XmlNode typeNode = xmlNode.SelectSingleNode("type"); if (typeNode != null) { if (typeNode.Attributes["href"] != null || typeNode.Attributes["id"] != null) { if (typeNode.Attributes["id"] != null) { typeIDRef_ = typeNode.Attributes["id"].Value; ElectricityProductTypeEnum ob = new ElectricityProductTypeEnum(typeNode); IDManager.SetID(typeIDRef_, ob); } else if (typeNode.Attributes["href"] != null) { typeIDRef_ = typeNode.Attributes["href"].Value; } else { type_ = new ElectricityProductTypeEnum(typeNode); } } else { type_ = new ElectricityProductTypeEnum(typeNode); } } XmlNode voltageNode = xmlNode.SelectSingleNode("voltage"); if (voltageNode != null) { if (voltageNode.Attributes["href"] != null || voltageNode.Attributes["id"] != null) { if (voltageNode.Attributes["id"] != null) { voltageIDRef_ = voltageNode.Attributes["id"].Value; PositiveDecimal ob = new PositiveDecimal(voltageNode); IDManager.SetID(voltageIDRef_, ob); } else if (voltageNode.Attributes["href"] != null) { voltageIDRef_ = voltageNode.Attributes["href"].Value; } else { voltage_ = new PositiveDecimal(voltageNode); } } else { voltage_ = new PositiveDecimal(voltageNode); } } }