public bool Parse(XmlNode node) { bool result = true; var typeAttribute = node.Attributes["type"]; var uniqueIdAttribute = node.Attributes["uniqueID"]; if (uniqueIdAttribute != null) { UniqueId = uniqueIdAttribute.InnerXml; } else { throw new Exception($"{GetType().Name} - missing uniqueID attribute"); } if (typeAttribute != null) { Type = typeAttribute.InnerXml; } else { throw new Exception($"{GetType().Name} - missing type attribute"); } foreach (XmlNode childNode in node.ChildNodes) { if (childNode.Name == "label") { var label = new XddLabel(childNode); if (!label.Parse()) { result = false; break; } Labels.Add(label); } else if (childNode.Name == "unit") { var unit = new XddUnit(); if (!unit.Parse(childNode)) { result = false; } Units.Add(unit); } if (!result) { break; } } return(result); }
public bool Parse(XmlNode node) { bool result = true; UniqueId = node.Attributes["uniqueID"].InnerXml; foreach (XmlNode childNode in node.ChildNodes) { if (childNode.Name == "label") { var label = new XddLabel(childNode); if (!label.Parse()) { result = false; break; } Labels.Add(label); } else if (childNode.Name == "paramIDRef") { var paramIdRef = new XddParamIdRef(); if (!paramIdRef.Parse(childNode)) { result = false; break; } ParamIdRef = paramIdRef; } else if (childNode.Name == "channelBuffer") { var channelBuffer = new ChannelBuffer(); if (!channelBuffer.Parse(childNode)) { result = false; break; } ChannelBuffer = channelBuffer; } } return(result); }
public bool Parse(XmlNode node) { bool result = true; var idAtt = node.Attributes["uniqueID"]; if (idAtt != null) { UniqueId = idAtt.InnerXml; foreach (XmlNode childNode in node) { if (childNode.Name == "label") { var label = new XddLabel(childNode); if (!label.Parse()) { result = false; break; } Labels.Add(label); } else if (childNode.Name == "description") { var description = new XddDescription(childNode); if (!description.Parse()) { result = false; break; } Descriptions.Add(description); } else if (childNode.Name == "role") { Role = childNode.InnerXml.Trim(); } } } return(result); }
public override bool Parse() { bool result = base.Parse(); if (result) { foreach (XmlNode childNode in Source.ChildNodes) { if (childNode.Name == "label") { var label = new XddLabel(childNode); if (label.Parse()) { Labels.Add(label); } } } } return(result); }