public static new CNoiTiep KhoiTao(XmlElement node) { CNoiTiep result = new CNoiTiep(); foreach (XmlElement nodeCon in node.ChildNodes) { string name = nodeCon.Name; CMachDien temp = null; switch (name) { case "NOI_TIEP": temp = CNoiTiep.KhoiTao(nodeCon); break; case "SONG_SONG": temp = CSongSong.KhoiTao(nodeCon); break; case "DIEN_TRO": temp = CDienTro.KhoiTao(nodeCon); break; } result._arrMachDien.Add(temp); } return(result); }
public XmlElement CreateNode(XmlDocument doc) { XmlElement result = doc.CreateElement("NOI_TIEP"); for (int i = 0; i < _arrMachDien.Count; ++i) { CMachDien temp = _arrMachDien[i]; // result.AppendChild(temp) } /* * for (CMachDien temp in _arrMachDien) * { * } */ return(result); }
public static CMachDien KhoiTao(XmlElement node) { CMachDien result = null; XmlElement nodeCon = (XmlElement)node.FirstChild; string name = nodeCon.Name; switch (name) { case "NOI_TIEP": result = CNoiTiep.KhoiTao(nodeCon); break; case "SONG_SONG": result = CSongSong.KhoiTao(nodeCon); break; case "DIEN_TRO": result = CDienTro.KhoiTao(nodeCon); break; } return(result); }
static void Main(string[] args) { CMachDien t = CMachDien.Doc(@"..\..\MachDien.xml"); }