public static TUpdateDeviceTagsReqDetail LoadFromXMLNode(XmlNode node) { if (node.Name != "Row") { return(null); } TUpdateDeviceTagsReqDetail rlt = new TUpdateDeviceTagsReqDetail(); rlt = IRAPXMLUtils.LoadValueFromXMLNode(node, rlt) as TUpdateDeviceTagsReqDetail; return(rlt); }
public static TUpdateDeviceTagsReqBody LoadFromXMLNode(XmlNode node) { if (!node.HasChildNodes) { Exception error = new Exception(); error.Data["ErrCode"] = "900001"; error.Data["ErrText"] = string.Format("XML 节点 [{0}] 是空节点", node.Name); throw error; } // 筛选出第一个 Parameters 节点,其余的 Parameters 节点忽略 XmlNode paramNode = null; foreach (XmlNode child in node.ChildNodes) { if (child.Name == "Parameters") { paramNode = child; break; } } // 如果不存在 Parameters 节点,则返回 null 值 if (paramNode == null) { Exception error = new Exception(); error.Data["ErrCode"] = "900001"; error.Data["ErrText"] = string.Format("XML 节点 [{0}] 是空节点", paramNode.Name); throw error; } // 筛选出第一个 Param 节点并解析生成 TUpdateDeviceTagsReqBody 对象,其余节点忽略 TUpdateDeviceTagsReqBody rlt = null; foreach (XmlNode child in paramNode.ChildNodes) { if (child.Name == "Param") { rlt = new TUpdateDeviceTagsReqBody(); rlt = IRAPXMLUtils.LoadValueFromXMLNode(child, rlt) as TUpdateDeviceTagsReqBody; break; } } // 如果不存在 Param 节点,则返回 null 值 if (rlt == null) { Exception error = new Exception(); error.Data["ErrCode"] = "900001"; error.Data["ErrText"] = string.Format("XML 节点 [{0}] 中没有找到 Param 节点", paramNode.Name); throw error; } foreach (XmlNode child in paramNode.ChildNodes) { if (child.Name == "ParamXML") { foreach (XmlNode row in child.ChildNodes) { if (row.Name == "Row") { rlt.Details.Add(TUpdateDeviceTagsReqDetail.LoadFromXMLNode(row)); } } break; } } return(rlt); }